svyscoretest.Rd
Performs two versions of the efficient score test. These are the same
for a single parameter. In the working
score test, different
parameters are weighted according to the inverse of the estimated population Fisher
information. In the pseudoscore
test, parameters are weighted according to the
inverse of their estimated covariance matrix.
svyscoretest(model, drop.terms=NULL, add.terms=NULL,
method=c("working","pseudoscore","individual"),ddf=NULL,
lrt.approximation = "satterthwaite", ...)
# S3 method for svyglm
svyscoretest(model, drop.terms=NULL, add.terms=NULL,
method=c("working","pseudoscore","individual"), ddf=NULL,
lrt.approximation = "satterthwaite",fullrank=TRUE, ...)
A model of a class having a svyscoretest
method (currently
just svyglm
)
Model formula giving terms to remove from model
Model formula giving terms to add to model
The type of score test to use. For a single parameter they are
equivalent. To report tests for each column separately use individual
denominator degrees of freedom for an F or linear combination
of F distributions. Use Inf
to get chi-squared
distributions. NULL
asks for the model residual degrees of
freedom, which is conservative.
For the working score, the method for computing/approximating the null
distribution: see pchisqsum
If FALSE
and method="individual"
, keep
even linearly dependent columns of the
efficient score
for future expansion
The working
score test will be asymptotically equivalent to the
Rao-Scott likelihood ratio test computed by regTermTest
and anova.svyglm
. The paper by Rao, Scott and Skinner calls this
a "naive" score test. The null distribution is a linear combination
of chi-squared (or F) variables.
The pseudoscore
test will be
asymptotically equivalent to the Wald test computed by
regTermTest
; it has a chi-squared (or F) null
distribution.
If ddf
is negative or zero, which can happen with large numbers
of predictors and small numbers of PSUs, it will be changed to 1 with a warning.
For "pseudoscore" and "working" score methods, a named vector with the test statistic, degrees of freedom, and p-value. For "individual" an object of class "svystat"
JNK Rao, AJ Scott, and C Rao, J., Scott, A., & Skinner, C. (1998). QUASI-SCORE TESTS WITH SURVEY DATA. Statistica Sinica, 8(4), 1059-1070.
data(myco)
dmyco<-svydesign(id=~1, strata=~interaction(Age,leprosy),weights=~wt,data=myco)
m_full<-svyglm(leprosy~I((Age+7.5)^-2)+Scar, family=quasibinomial, design=dmyco)
svyscoretest(m_full, ~Scar)
#> Rao-Scott X^2 ddf p
#> 1.076178e+01 5.020000e+02 1.108194e-03
svyscoretest(m_full,add.terms= ~I((Age+7.5)^-2):Scar)
#> Rao-Scott X^2 ddf p
#> 6.461623e-03 5.020000e+02 9.359637e-01
svyscoretest(m_full,add.terms= ~factor(Age), method="pseudo")
#> Warning: 1 linear dependency removed
#> X2 df ddf p
#> 3.221403e+01 4.000000e+00 5.020000e+02 6.491734e-24
svyscoretest(m_full,add.terms= ~factor(Age),method="individual",fullrank=FALSE)
#> total SE
#> factor(Age)12.5 6.2221 1.5180
#> factor(Age)17.5 2.7633 3.0650
#> factor(Age)22.5 -4.3934 2.3640
#> factor(Age)27.5 2.1967 1.6124
#> factor(Age)32.5 -3.4778 2.7989
svyscoretest(m_full,add.terms= ~factor(Age),method="individual")
#> Warning: 1 linear dependency removed
#> total SE
#> factor(Age)12.5 6.2221 1.5180
#> factor(Age)17.5 2.7633 3.0650
#> factor(Age)22.5 -4.3934 2.3640
#> factor(Age)27.5 2.1967 1.6124