\[\newcommand{\E}{\mathbb{E}}\]
For this problem, we will use the Caschools
data which you can load with the following command (you may need to install the Ecdat
package first if you have not previously done so)
data(Caschool, package="Ecdat")
I would like for you to run a regression of mathscr
on the following variables: grspan
, enrltot
, teachers
, calwpct
, mealpct
, computer
, compstu
, expnstu
, str
, avginc
, elpct
.
Besides the intercept, which regressor has the largest t-statistics in absolute value, and what is the t-statistic?
Rules:
To win
Solution below…
data(Caschool, package="Ecdat")
reg <- lm(mathscr ~ grspan + enrltot + teachers + calwpct + mealpct + computer + compstu + expnstu + str + avginc + elpct, data=Caschool)
summary(reg)
##
## Call:
## lm(formula = mathscr ~ grspan + enrltot + teachers + calwpct +
## mealpct + computer + compstu + expnstu + str + avginc + elpct,
## data = Caschool)
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.9365 -6.6218 -0.1643 5.4444 30.2329
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.694e+02 1.158e+01 57.814 < 2e-16 ***
## grspanKK-08 -4.200e+00 1.425e+00 -2.946 0.003402 **
## enrltot 4.245e-05 1.928e-03 0.022 0.982447
## teachers -9.168e-03 4.259e-02 -0.215 0.829675
## calwpct -1.335e-01 6.829e-02 -1.955 0.051304 .
## mealpct -3.151e-01 4.291e-02 -7.345 1.13e-12 ***
## computer 4.373e-03 3.663e-03 1.194 0.233268
## compstu 8.566e+00 9.087e+00 0.943 0.346407
## expnstu -9.255e-05 1.065e-03 -0.087 0.930762
## str -2.882e-01 3.814e-01 -0.756 0.450193
## avginc 6.948e-01 1.049e-01 6.624 1.11e-10 ***
## elpct -1.591e-01 4.154e-02 -3.830 0.000148 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.839 on 408 degrees of freedom
## Multiple R-squared: 0.732, Adjusted R-squared: 0.7247
## F-statistic: 101.3 on 11 and 408 DF, p-value: < 2.2e-16
The largest t-statistic (in absolute value) is for mealpct
and it is equal to -7.345.