####################################### # # SOME INITIAL SIMPLE LINEAR REGRESSION STUFF # ####################################### > attach(prestige) > motif() > plot(income,occ.prestige) > myfit <- lm(occ.prestige ~ income, data=prestige) > summary(myfit) Call: lm(formula = occ.prestige ~ income) Residuals: Min 1Q Median 3Q Max -33.01 -8.378 -2.378 8.432 32.08 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 27.1412 2.2677 11.9686 0.0000 income 0.0029 0.0003 10.2243 0.0000 Residual standard error: 12.09 on 100 degrees of freedom Multiple R-Squared: 0.5111 F-statistic: 104.5 on 1 and 100 degrees of freedom, the p-value is 0 Correlation of Coefficients: (Intercept) income -0.8493 > anova(myfit) Analysis of Variance Table Response: occ.prestige Terms added sequentially (first to last) Df Sum of Sq Mean Sq F Value Pr(F) income 1 15279.26 15279.26 104.5367 0 Residuals 100 14616.17 146.16 > lines(income,fitted(myfit)) Lines out of bounds X= 25879 Y= 102.1074 Lines out of bounds X= 9271 Y= 53.9974 Lines out of bounds X= 25308 Y= 100.4534 Lines out of bounds X= 14558 Y= 69.3128 > plot(income,residuals(myfit)) > plot(fitted(myfit),residuals(myfit)) > par(mfrow=c(2,3)) > plot(myfit) > summary(myfit) Call: lm(formula = occ.prestige ~ income) Residuals: Min 1Q Median 3Q Max -33.01 -8.378 -2.378 8.432 32.08 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 27.1412 2.2677 11.9686 0.0000 income 0.0029 0.0003 10.2243 0.0000 Residual standard error: 12.09 on 100 degrees of freedom Multiple R-Squared: 0.5111 F-statistic: 104.5 on 1 and 100 degrees of freedom, the p-value is 0 Correlation of Coefficients: (Intercept) income -0.8493 > q()