boot2lme {svylme} | R Documentation |
Resampling variances for svy2lme
Description
Computes variance estimates for the weighted-pairwise-likelihood
linear mixed models fitted by svy2lme
using replicate
weights. The replicate weights for a pair are obtained by dividing by
the sampling weight and then multiplying by the replicate
weight. There will be a warning if the ratio of replicate weight to
sampling weight differs for observations in the same pair.
Usage
boot2lme(model, rdesign, verbose = FALSE)
## S3 method for class 'boot2lme'
vcov(object,
parameter=c("beta", "theta","s2", "relSD" ,"SD","relVar","fullVar"),
...)
Arguments
model |
A model returned by |
rdesign |
replicate-weights design corresponding to the design used to fit the model, see example |
verbose |
print progess information? |
object |
returned by |
... |
for method compatibility |
parameter |
Variance matrix for: regression parameters, relative variance parameters on Cholesky square root scale, residual variance, relative standard errors of random effects, standard errors of random effects, entire relative variance matrix, entire variance matrix |
Details
The variance is estimated from the replicates thetastar
and original point estimate theta
as scale*sum(rscales* (thetastar-theta)^2)
.
Value
For boot2lme
, an object of class boot2lme
with components
theta |
replicates of variance parameters (on Cholesky square root scale) |
beta |
replicates of regression parameters |
D |
replicates of relative variance matrix |
scale , rscales |
from the input |
formula |
model formula from the input |
For the vcov
method, a variance matrix.
Examples
data(api, package="survey")
# two-stage cluster sample
dclus2<-svydesign(id=~dnum+snum, fpc=~fpc1+fpc2, data=apiclus2)
m0<-svy2lme(api00~(1|dnum)+ell+mobility, design=dclus2,return.devfun=TRUE)
jkdes<-as.svrepdesign(dclus2, type="mrb")
jkvar<-boot2lme(m0,jkdes)
SE(jkvar, "beta")
SE(jkvar, "SD")
SE(jkvar,"s2")
m1<-svy2lme(api00~(1|dnum)+ell+mobility,
design=dclus2,return.devfun=TRUE, all.pairs=TRUE, subtract.margins=TRUE)
jk1var<-boot2lme(m1,jkdes)
SE(jk1var, "beta")
SE(jk1var, "SD")
##takes a few minutes
data(pisa)
pisa$w_condstuwt<-with(pisa, w_fstuwt/wnrschbw)
pisa$id_student<-1:nrow(pisa)
dpisa<-survey::svydesign(id=~id_school+id_student, weight=~wnrschbw+w_condstuwt, data=pisa)
m<-svy2lme(isei~(1+female|id_school)+female+high_school+college+one_for+both_for+test_lang,
design=dpisa, return.devfun=TRUE,method="nested")
bpisa<-as.svrepdesign(dpisa, type="bootstrap", replicates=100)
b<-boot2lme(m, bpisa, verbose=TRUE)
str(b)
vcov(b,"beta")
vcov(b,"s2")
## SE() inherits the parameter= argument
SE(b,"beta")
SE(b,"theta")
SE(b,"SD")