4 speed 175890 ispeed2 8775200 solvetxx txmpg 1

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: I(Speed^2) 61950 3599750 222888750 > t(X) %*% MPG [,1] (Intercept) 403.4 Speed 17589.0 I(Speed^2) 877520.0 > solve(t(X)%*%X) %*% t(X)%*%MPG [,1] (Intercept) -7.55554945 Speed 1.27169368 I(Speed^2) -0.01450137 > x = seq(10,75,by=0.1) > y = fit$coefficients[1] + fit$coefficients[2]*x + fit$coefficients[3]*x^2 > lines(x,y) > plot(fit$fitted.values,fit$residuals) > abline(h=0,lty=2) > fit2 = lm(MPG ~ Speed + I(Speed^2) + I(Speed^3)) > summary(fit2) Call: lm(formula = MPG ~ Speed + I(Speed^2) + I(Speed^3)) Residuals: Min 1Q -2.81124 -0.96768 Median 0.02637 3Q 1.03454 Max 3.38268 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -7.742e+00 2.768e+00 -2.797 0.0100 ** Speed 1.291e+00 2.529e-01 5.103 3.2e-05 *** I(Speed^2) -1.502e-02 6.604e-03 -2.274 0.0322 * I(Speed^3) 4.066e-06 5.132e-05 0.079 0.9375 --Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.697 on 24 degrees of freedom Multiple R-Squared: 0.9188, Adjusted R-squared: 0.9087 F-statistic: 90.56 on 3 and 24 DF, p-value: 3.170e-13 > plot(fit2$fitted.values,fit2$residuals) > abline(h=0,lty=2) > fit3 = lm(MPG ~ Speed + I(Speed^2) + I(Speed^3) + I(Speed^4)) > summary(fit3) Call: lm(formula = MPG ~ Speed + I(Speed^2) + I(Speed^3) + I(Speed^4)) Residuals: Min 1Q -1.57410 -0.60308 Median 0.04236 3Q 0.74481 Max 1.93038 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.146e+01 2.965e+00 3.866 0.000785 *** Speed -1.468e+00 3.913e-01 -3.751 0.001042 ** I(Speed^2) 1.081e-01 1.673e-02 6.463 1.35e-06 *** I(Speed^3) -2.130e-03 2.844e-04 -7.488 1.31e-07 *** I(Speed^4) 1.255e-05 1.665e-06 7.539 1.17e-07 *** --Signif. codes: 0 '***' 0.001 '**' 0.0...
View Full Document

This note was uploaded on 04/03/2014 for the course STAT 420 taught by Professor Stepanov during the Spring '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online