[R] Joint significance of more regressors in summary
Kingsford Jones
kingsfordjones at gmail.com
Thu Jan 22 02:17:54 CET 2009
try
install.packages('car')
?car::linear.hypothesis
hth,
Kingsford Jones
On Wed, Jan 21, 2009 at 4:20 PM, Roberto Patuelli
<roberto.patuelli at lu.unisi.ch> wrote:
> Dear All,
>
> I was wondering if it is possible to generate a regression summary (it does
> not matter at this stage if from an lm or for example a glm estimate) in
> which to obtain the joint significance of a set of regressors?
> Examples could be looking at the joint significance level of a polynomial,
> or of a set of exogenous variables of which is of interest the linear
> combination suggested by the regression parameters.
> With regard to the latter, it would also be cool to visualize directly the
> linear combination of such group of variables, which will obviously have a
> regression coefficient of 1. The standard error and significance level,
> though, are less obvious.
>
> I would expect - please correct me if I'm wrong - that a simple ANOVA
> comparison between two models with and without this set of variables would
> give the significance level. But what if there are two sets of variables
> included in the model for which to find joint significance (that is, set by
> set)?
>
> I hope someone can help. As an example, please see the regression output
> below, from a quasipoisson estimation.
> I have two large set of eigenvector decomposition variables, one marked by
> "_o" and one by "_d". For these two sets of variables, I would like to have,
> in the regression summary, only two lines, with Estimate, Std. Error,
> t-value and Pr(>|t|).
> Obviously I can do this by hand, constructing the linear combinations,
> rerunning the model, and therefore obtaining a standard error and a p-value
> for each set. But the degrees of freedom of the model would in reality be
> different...
>
> Thanks in advance for any help!
>
> Cheers
> Roberto Patuelli
> Post-doc researcher
> Institute for Economic Research (IRE)
> University of Lugano
> Email: roberto.patuelli at lu.unisi.ch
> Homepage: http://www.people.lu.unisi.ch/patuellr
>
> *****************************
>
>> dep.qglm <- glm(dep ~ lndist + com_lang + contig + history + fta +
>> lnarea_i + lngdppc_i + lngdp_i + island_i + landl_i + lnarea_e + lngdp_e +
>> lngdppc_e + island_e + landl_e
>
> + + e1_o + e3_o + e4_o + e5_o + e7_o + e8_o + e9_o + e10_o + e11_o + e12_o +
> e13_o + e14_o + e15_o + e17_o + e18_o + e19_o + e20_o + e21_o + e22_o +
> e23_o + e24_o
> + + e1_d + e2_d + e4_d + e5_d + e7_d + e8_d + e9_d + e10_d + e12_d + e13_d +
> e14_d + e16_d + e17_d + e18_d + e19_d + e20_d + e22_d + e23_d + e24_d +
> e25_d + e26_d + e27_d + e28_d + e29_d + e30_d, family = quasipoisson (link =
> log))
>>
>> summary(dep.qglm)
>
> Call:
> glm(formula = dep ~ lndist + com_lang + contig + history + fta +
> lnarea_i + lngdppc_i + lngdp_i + island_i + landl_i + lnarea_e +
> lngdp_e + lngdppc_e + island_e + landl_e + e1_o + e3_o +
> e4_o + e5_o + e7_o + e8_o + e9_o + e10_o + e11_o + e12_o +
> e13_o + e14_o + e15_o + e17_o + e18_o + e19_o + e20_o + e21_o +
> e22_o + e23_o + e24_o + e1_d + e2_d + e4_d + e5_d + e7_d +
> e8_d + e9_d + e10_d + e12_d + e13_d + e14_d + e16_d + e17_d +
> e18_d + e19_d + e20_d + e22_d + e23_d + e24_d + e25_d + e26_d +
> e27_d + e28_d + e29_d + e30_d, family = quasipoisson(link = log))
>
> Deviance Residuals:
> Min 1Q Median 3Q Max
> -137.3970 -4.3775 -1.8095 -0.6143 195.3221
>
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) -29.311658 0.243063 -120.593 < 2e-16 ***
> lndist -0.608668 0.009603 -63.386 < 2e-16 ***
> com_lang 0.162357 0.021064 7.708 1.34e-14 ***
> contig 0.578563 0.023609 24.506 < 2e-16 ***
> history 0.176760 0.023113 7.647 2.15e-14 ***
> fta 0.411314 0.018823 21.851 < 2e-16 ***
> lnarea_i -0.137816 0.008402 -16.404 < 2e-16 ***
> lngdppc_i 0.003957 0.018315 0.216 0.828937
> lngdp_i 0.816396 0.010770 75.801 < 2e-16 ***
> island_i 0.118761 0.030618 3.879 0.000105 ***
> landl_i -0.337145 0.040638 -8.296 < 2e-16 ***
> lnarea_e -0.054909 0.006349 -8.649 < 2e-16 ***
> lngdp_e 0.808997 0.009182 88.111 < 2e-16 ***
> lngdppc_e 0.012582 0.012363 1.018 0.308837
> island_e -0.202474 0.029096 -6.959 3.55e-12 ***
> landl_e -0.226312 0.041144 -5.501 3.84e-08 ***
> e1_o 0.685095 0.130636 5.244 1.59e-07 ***
> e3_o -1.204244 0.140884 -8.548 < 2e-16 ***
> e4_o -1.311745 0.433108 -3.029 0.002460 **
> e5_o -1.539045 0.278576 -5.525 3.34e-08 ***
> e7_o 1.722945 0.145778 11.819 < 2e-16 ***
> e8_o 1.286667 0.124809 10.309 < 2e-16 ***
> e9_o 0.359851 0.111494 3.228 0.001251 **
> e10_o 3.783921 0.288042 13.137 < 2e-16 ***
> e11_o 0.429692 0.138996 3.091 0.001995 **
> e12_o -0.707160 0.087880 -8.047 9.00e-16 ***
> e13_o -2.231826 0.225201 -9.910 < 2e-16 ***
> e14_o -0.256754 0.108398 -2.369 0.017865 *
> e15_o -0.408286 0.158939 -2.569 0.010212 *
> e17_o 0.297300 0.125250 2.374 0.017623 *
> e18_o -0.969633 0.357462 -2.713 0.006683 **
> e19_o -1.201774 0.116932 -10.278 < 2e-16 ***
> e20_o -1.508240 0.151872 -9.931 < 2e-16 ***
> e21_o 0.551079 0.269277 2.047 0.040720 *
> e22_o -1.692244 0.145631 -11.620 < 2e-16 ***
> e23_o -0.383306 0.104032 -3.685 0.000230 ***
> e24_o 0.521337 0.102742 5.074 3.93e-07 ***
> e1_d 1.782647 0.200351 8.898 < 2e-16 ***
> e2_d 1.810030 0.228498 7.921 2.48e-15 ***
> e4_d -1.614327 0.407554 -3.961 7.49e-05 ***
> e5_d -2.177586 0.288719 -7.542 4.83e-14 ***
> e7_d 0.685296 0.150117 4.565 5.03e-06 ***
> e8_d 0.581178 0.129893 4.474 7.71e-06 ***
> e9_d 0.383017 0.136256 2.811 0.004944 **
> e10_d 1.057013 0.302056 3.499 0.000467 ***
> e12_d -1.715899 0.098873 -17.355 < 2e-16 ***
> e13_d -2.186354 0.306954 -7.123 1.10e-12 ***
> e14_d -0.644178 0.186572 -3.453 0.000556 ***
> e16_d 0.432474 0.128943 3.354 0.000798 ***
> e17_d 0.411581 0.141766 2.903 0.003698 **
> e18_d -2.096561 0.417727 -5.019 5.24e-07 ***
> e19_d -0.828071 0.139642 -5.930 3.08e-09 ***
> e20_d -1.403737 0.162520 -8.637 < 2e-16 ***
> e22_d -2.012591 0.114711 -17.545 < 2e-16 ***
> e23_d -0.510387 0.163163 -3.128 0.001762 **
> e24_d 1.139063 0.145660 7.820 5.56e-15 ***
> e25_d -0.512741 0.175212 -2.926 0.003433 **
> e26_d 1.931725 0.224658 8.599 < 2e-16 ***
> e27_d -1.184863 0.114861 -10.316 < 2e-16 ***
> e28_d 1.022568 0.147280 6.943 3.96e-12 ***
> e29_d -1.403916 0.224753 -6.246 4.29e-10 ***
> e30_d 0.769500 0.231363 3.326 0.000883 ***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> (Dispersion parameter for quasipoisson family taken to be 217.7894)
>
> Null deviance: 40268568 on 18631 degrees of freedom
> Residual deviance: 2453593 on 18570 degrees of freedom
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list