User Tools

Site Tools


r:linear_regression

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
r:linear_regression [2018/12/07 08:18] – [Multiple Regression] hkimscilr:linear_regression [2018/12/07 10:54] – [Multiple Regression] hkimscil
Line 162: Line 162:
  
 ====== Multiple Regression ====== ====== Multiple Regression ======
 +regression output table
 | anova(m)  | ANOVA table  | | anova(m)  | ANOVA table  |
 | coefficients(m) = coef(m)  | Model coefficients  | | coefficients(m) = coef(m)  | Model coefficients  |
Line 201: Line 202:
   * How many cars are involved in this test? (cf. df = 90)   * How many cars are involved in this test? (cf. df = 90)
   * If I eliminate the R<sup>2</sup> from the above output, can you still identify what it is?   * If I eliminate the R<sup>2</sup> from the above output, can you still identify what it is?
 +</WRAP>
 +<WRAP box info>The last question: 
 +  * If I eliminate the R<sup>2</sup> from the above output, can you still identify what it is?
 +  * to answer the question, use the regression output table:
 +
 +R<sup>2</sup> = SS<sub>reg</sub>/SS<sub>total</sub> = 1 - SS<sub>res</sub>/SS<sub>total</sub>
 +
 +
 +<code>> anova(lm.model)
 +Analysis of Variance Table
 +
 +Response: Cars93$MPG.city
 +                  Df Sum Sq Mean Sq F value  Pr(>F)    
 +Cars93$EngineSize  1   1465    1465  100.65 2.4e-16 ***
 +Cars93$Price          131     131    9.01  0.0035 ** 
 +Residuals         90   1310      15                    
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +> sstotal = 1465+131+1310
 +> ssreg <- 1465+131
 +> ssreg/sstotal
 +[1] 0.54921
 +> > 
 +</code>
 +
 +
 </WRAP> </WRAP>
  
r/linear_regression.txt · Last modified: 2019/06/13 10:15 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki