10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Linear regression 295Call:lm(<strong>for</strong>mula=num.grade ~ ., data=stud.recs)Coefficients:(Intercept) seq.1 seq.2 seq.3sat.v−0.73953 −0.00394 −0.00272 0.01565− 0.00125sat .m0.00590Some terms are negative, which seems odd. Looking at the summary of the regressionmodel we have> summary(res.1m)...Coefficients:Estimate Std. Error t value Pr(>|t|)(Intercept) −0.73953 1.21128 −0.61 0.543seq.1 −0.00394 0.01457 −0.27 0.787seq.2 −0.00272 0.01503 −0.18 0.857seq.3 0.01565 0.00941 1.66 0.099 .sat.v −0.00125 0.00163 −0.77 0.443sat.m 0.00590 0.00267 2.21 0.029 *...The marginal t-tests <strong>for</strong> whether the given parameter is a or not are “rejected” only <strong>for</strong> theseq. 3 (sequential 3 is the last high school test taken) and sat .m (the math SAT score). Itis important to remember that these are tests concerning whether the value is a given theother predictors. They can change if predictors are removed.The stepAIC() function can step through the various submodels and rank them byAIC. This gives> library(MASS) # load in MASS package <strong>for</strong>stepAIC> stepAIC(res.lm)Start: AIC= 101.2... lots skipped ...Coefficients:(Intercept) seq.3 sat.m−1.14078 0.01371 0.00479The submodel with just two predictors is selected. As expected, the verbal scores on theSAT are not a good indicator of per<strong>for</strong>mance.10.3.6 Problems10.20 Do Example 10.5 and fit the full model to the data. For which variables is the t-test<strong>for</strong> β i =0 flagged? What model is selected by AIC?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!