1

Hi I have a quick question about the regtermtest. Let's say I am running the following regression:

data(api)
dclus1 <- svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
model1 <- svyglm(api00~ relevel(both, ref =  "Yes")*relevel(awards, ref="Yes") + meals, design = dclus1, family = gaussian(link='log'))

This checks to see if the interaction effect is significant

regTermTest(model1,~ relevel(both, ref =  "Yes"):relevel(awards, ref="Yes") , method= "LRT"))

This checks the joint contribution of the main effects plus the interaction effect

regTermTest(model1,~ relevel(both, ref =  "Yes")*relevel(awards, ref="Yes") , method= "LRT")

But lets say I want to check if the individual levels of awards is signficant. Would I do the following?

model2<-  svyglm(api00~ relevel(awards, ref="Yes") , design = dclus1, family = gaussian(link='log'))
anova(model1,model2,force=TRUE)

Maybe you can do the following?

Thanks.

  • 1
    You should say whether the data and design elements are part of the examples in the survey package. If they are not then you should either post adequate data and design objects ot recast you question using sata that is part of the package. Otherwise this is not a programming question as defined by SO and may get closed. – IRTFM Jan 17 '22 at 17:58
  • This data is from my work, not the survey package. I'll go ahead and use their data . Thanks. – LittleBlueHeron Jan 17 '22 at 18:06

1 Answers1

3

As always there is no such thing as the significance of an individual level. There is only significance of a contrast between two levels or for the inclusion of a group of levels versus their absence in a model. (Using the example dataset) if you thought the meals should be in the model, then checking to see of a particular contrast were significant outside the model would not be a particularly wise question to raise. If you use the summary function (which is provided for most R regression models) then you can look at individual contrasts of a particular level versus the corresponding base level with a Wald test:

summary(model1)

Call:
svyglm(formula = api00 ~ relevel(both, ref = "Yes") * relevel(awards, 
    ref = "Yes") + meals, design = dclus1, family = gaussian(link = "log"))

Survey design:
svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc)

Coefficients: (1 not defined because of singularities)
                                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)                     6.7405902  0.0210132 320.779  < 2e-16 ***
relevel(both, ref = "Yes")No    0.1549098  0.0658995   2.351   0.0384 *  
relevel(awards, ref = "Yes")No -0.1973033  0.0714367  -2.762   0.0185 *  
meals                          -0.0053073  0.0003384 -15.682 7.13e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for gaussian family taken to be 2825.009)

Number of Fisher Scoring iterations: 4
IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • 1
    Yes, use `summary` if you want individual contrasts; the point of `regTermTest` is to provide tests for whole regression terms, and that's all it does. – Thomas Lumley Apr 04 '22 at 23:56
  • @ThomasLumley; I notice that there is no deviance calculation in the `summary` output. I suppose that means there is a different mechanism for calculation of the test statistic for whole regression terms in survey weighted procedures. (I could probably look up the answer in your book, but if you had a pithy comment it might improve this entry on SO.) – IRTFM Jun 20 '22 at 14:40