regTermTest.Rd
Provides Wald test and working Wald and working likelihood ratio (Rao-Scott) test of the
hypothesis that all coefficients associated with a particular
regression term are zero (or have some other specified
values). Particularly useful as a substitute for anova
when not fitting by maximum likelihood.
regTermTest(model, test.terms, null=NULL,df=NULL,
method=c("Wald","WorkingWald","LRT"), lrt.approximation="saddlepoint")
Character string or one-sided formula giving name of term or terms to test
Null hypothesis values for parameters. Default is zeros
Denominator degrees of freedom for an F test. If
NULL
these are estimated from the model. Use Inf
for a
chi-squared test.
If "Wald"
, the Wald-type test; if "LRT"
the Rao-Scott test based on the estimated log likelihood ratio; If
"WorkingWald"
the Wald-type test using the variance matrix
under simple random sampling
method for approximating the distribution of
the LRT and Working Wald statistic; see pchisqsum
.
An object of class regTermTest
or regTermTestLRT
.
The Wald test uses a chisquared or F distribution. The two
working-model tests come from the (misspecified) working model where the
observations are independent and the weights are frequency weights. For
categorical data, this is just the model fitted to the estimated
population crosstabulation. The Rao-Scott LRT statistic is the likelihood
ratio statistic in this model. The working Wald test statistic is the Wald statistic
in this model. The working-model tests do not have a chi-squared
sampling distribution: we use a linear combination of chi-squared or F
distributions as in pchisqsum
. I believe the working Wald
test is what SUDAAN refers to as a
"Satterthwaite adjusted Wald test".
To match other software you will typically need to use lrt.approximation="satterthwaite"
Rao, JNK, Scott, AJ (1984) "On Chi-squared Tests For Multiway Contingency Tables with Proportions Estimated From Survey Data" Annals of Statistics 12:46-60.
Lumley T, Scott A (2012) "Partial likelihood ratio tests for the Cox model under complex sampling" Statistics in Medicine 17 JUL 2012. DOI: 10.1002/sim.5492
Lumley T, Scott A (2014) "Tests for Regression Models Fitted to Survey Data" Australian and New Zealand Journal of Statistics 56:1-14 DOI: 10.1111/anzs.12065
The "LRT"
method will not work if the model had starting values supplied for the regression coefficients. Instead, fit the two models separately and use anova(model1, model2, force=TRUE)
data(esoph)
model1 <- glm(cbind(ncases, ncontrols) ~ agegp + tobgp *
alcgp, data = esoph, family = binomial())
anova(model1)
#> Analysis of Deviance Table
#>
#> Model: binomial, link: logit
#>
#> Response: cbind(ncases, ncontrols)
#>
#> Terms added sequentially (first to last)
#>
#>
#> Df Deviance Resid. Df Resid. Dev
#> NULL 87 367.95
#> agegp 5 121.045 82 246.91
#> tobgp 3 36.639 79 210.27
#> alcgp 3 127.933 76 82.34
#> tobgp:alcgp 9 5.451 67 76.89
regTermTest(model1,"tobgp")
#> Wald test for tobgp
#> in glm(formula = cbind(ncases, ncontrols) ~ agegp + tobgp * alcgp,
#> family = binomial(), data = esoph)
#> F = 6.080611 on 3 and 67 df: p= 0.0010073
regTermTest(model1,"tobgp:alcgp")
#> Wald test for tobgp:alcgp
#> in glm(formula = cbind(ncases, ncontrols) ~ agegp + tobgp * alcgp,
#> family = binomial(), data = esoph)
#> F = 0.5880663 on 9 and 67 df: p= 0.80234
regTermTest(model1, ~alcgp+tobgp:alcgp)
#> Wald test for alcgp alcgp:tobgp
#> in glm(formula = cbind(ncases, ncontrols) ~ agegp + tobgp * alcgp,
#> family = binomial(), data = esoph)
#> F = 8.358247 on 12 and 67 df: p= 2.2352e-09
data(api)
dclus2<-svydesign(id=~dnum+snum, weights=~pw, data=apiclus2)
model2<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility, design=dclus2, family=quasibinomial())
regTermTest(model2, ~ell)
#> Wald test for ell
#> in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility,
#> design = dclus2, family = quasibinomial())
#> F = 6.055448 on 1 and 36 df: p= 0.018792
regTermTest(model2, ~ell,df=NULL)
#> Wald test for ell
#> in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility,
#> design = dclus2, family = quasibinomial())
#> F = 6.055448 on 1 and 36 df: p= 0.018792
regTermTest(model2, ~ell, method="LRT", df=Inf)
#> Working (Rao-Scott) LRT for ell
#> in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility,
#> design = dclus2, family = quasibinomial())
#> Working 2logLR = 6.781297 p= 0.0096772
#> df=1
regTermTest(model2, ~ell+meals, method="LRT", df=NULL)
#> Working (Rao-Scott+F) LRT for ell meals
#> in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility,
#> design = dclus2, family = quasibinomial())
#> Working 2logLR = 4.692659 p= 0.11957
#> (scale factors: 1.6 0.37 ); denominator df= 36
regTermTest(model2, ~ell+meals, method="WorkingWald", df=NULL)
#> Working (Rao-Scott+F) for ell meals
#> in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility,
#> design = dclus2, family = quasibinomial())
#> Working Wald statistic = 4.196737 p= 0.14263
#> (scale factors: 1.6 0.37 ); denominator df= 36