Keywords: R-car stopping distances 1920+quadratic.svg en A simple graph of car stopping distances with a simple quadratic zero intercept fit and residual plot Own HYanWong 2008-12-13 Created with R using the following commands <pre>svg R-car_stopping_distances_1920+quadratic svg 8 4 8 layout t 1 2 par mar c 5 4 1 2 + 0 1 cars speed kph <- cars speed 1 609344 cars dist m <- cars dist 0 3048 plot dist m ~ speed kph data cars xlab Speed km/h ylab Stopping distance m las 1 quad model <- lm dist m~I speed kph 2 -1 data cars curve quad model coef1 x 2 col red add TRUE segments cars speed kph fitted values quad model cars speed kph fitted values quad model +residuals quad model col lightblue par mar c 5 5 1 1 + 0 1 plot residuals quad model type h ylim c -25 25 bty n xaxt n las 2 xlab NA ylab residual stopping distance m col lightblue grid NA NULL abline h 0 points residuals quad model dev off </pre> Uncategorized 2015 March 23 |