|
|
Testing Linear Models> p15 <-saving.x[,1] > p75 <-saving.x[,2] > inc <-saving.x[,3] > gro <-saving.x[,4] > sav <-saving.x[,5] Testing a single predictorSuppose our objective is to model the savings rate as a function of the other four variables:
> summary(g) Call: lm(formula = sav ~ p15 + p75 + inc + gro) Residuals: Min 1Q Median 3Q Max -8.242 -2.686 -0.2491 2.428 9.751 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 28.5666 7.3545 3.8842 0.0003 p15 -0.4612 0.1446 -3.1886 0.0026 p75 -1.6916 1.0836 -1.5611 0.1255 inc -0.0003 0.0009 -0.3617 0.7193 gro 0.4097 0.1962 2.0882 0.0425 Residual standard error: 3.803 on 45 degrees of freedom Multiple R-Squared: 0.3385 F-statistic: 5.756 on 4 and 45 degrees of freedom, the p-value is 0.0007902 Let's do the same test using the general F-testing approach: We'll need the RSS and df for the full model (which represents the alternative hypothesis:
[1] 650.7061 > g$df [1] 45
[1] 797.7234 > (797.7234-650.706)/(650.706/45) [1] 10.16708
[1] 0.002602461
[1] 3.188586 > 2*(1-pt(3.188586,45)) [1] 0.002602461
Testing all the predictorsWe can also test whether any of the predictors have significance in the model. In other words, whether ß1 = ß2 = ß3 = ß4 = 0.We can do it directly using the F-testing formula:
[1] 983.6282 > ((983.6282-650.706)/4)/(650.706/45) [1] 5.755863 > 1-pf(5.755863,4,45) [1] 0.0007902025
Question Suppose we believe that people under 15 or over 75 are indistinguishable in their effect on the savings rate. We might believe that they are dependents that have an equivalent effect. Express this hypothesis in statistical terms and test it.
|