r:linear_regression
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
r:linear_regression [2018/12/07 08:07] – [E.g. 1] hkimscil | r:linear_regression [2019/06/13 10:15] (current) – hkimscil | ||
---|---|---|---|
Line 162: | Line 162: | ||
====== Multiple Regression ====== | ====== Multiple Regression ====== | ||
+ | regression output table | ||
| anova(m) | | anova(m) | ||
| coefficients(m) = coef(m) | | coefficients(m) = coef(m) | ||
Line 197: | Line 198: | ||
F-statistic: | F-statistic: | ||
</ | </ | ||
- | Questions: | + | <WRAP box help>Questions: |
* What is R< | * What is R< | ||
* How many cars are involved in this test? (cf. df = 90) | * How many cars are involved in this test? (cf. df = 90) | ||
+ | * df + # of variables involved (3) = 93 | ||
+ | * check ' | ||
* If I eliminate the R< | * If I eliminate the R< | ||
+ | </ | ||
+ | <WRAP box info>The last question: | ||
+ | * If I eliminate the R< | ||
+ | * to answer the question, use the regression output table: | ||
+ | |||
+ | R< | ||
+ | = | ||
+ | |||
+ | < | ||
+ | Analysis of Variance Table | ||
+ | |||
+ | Response: Cars93$MPG.city | ||
+ | Df Sum Sq Mean Sq F value Pr(> | ||
+ | Cars93$EngineSize | ||
+ | Cars93$Price | ||
+ | Residuals | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | |||
+ | > sstotal = 1465+131+1310 | ||
+ | > ssreg <- 1465+131 | ||
+ | > ssreg/ | ||
+ | [1] 0.54921 | ||
+ | > | ||
+ | > # or | ||
+ | > 1-(deviance(lm.model)/ | ||
+ | [1] 0.54932 | ||
+ | </ | ||
+ | |||
+ | |||
+ | </ | ||
Regression formula: | Regression formula: | ||
* $\hat{Y} = -2.99 * EngineSize + -0.15 * Price + 33.35$ | * $\hat{Y} = -2.99 * EngineSize + -0.15 * Price + 33.35$ | ||
* $\hat{Y} = \widehat{\text{MPG.city}}$ | * $\hat{Y} = \widehat{\text{MPG.city}}$ | ||
+ | |||
+ | <WRAP box info>in the meantime, | ||
+ | < | ||
+ | Cars93$EngineSize | ||
+ | | ||
+ | > cor(MPG.city, | ||
+ | [1] -0.7100032 | ||
+ | > cor(EngineSize, | ||
+ | [1] 0.5974254 | ||
+ | > cor(MPG.city, | ||
+ | [1] -0.5945622 | ||
+ | > | ||
+ | </ | ||
+ | Or . . . . | ||
+ | < | ||
+ | > temp | ||
+ | . . . . | ||
+ | |||
+ | > cor(temp) | ||
+ | | ||
+ | MPG.city | ||
+ | EngineSize -0.7100032 | ||
+ | Price -0.5945622 | ||
+ | > | ||
+ | </ | ||
+ | Beta coefficients are not equal to correlations among variables. | ||
+ | </ | ||
< | < |
r/linear_regression.1544137668.txt.gz · Last modified: 2018/12/07 08:07 by hkimscil