-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Welcome to the svylme
wiki!
This project is developing mixed model software in R for data from complex surveys.
At the moment, there's one main function svy2lme
, which fits linear mixed models by pairwise composite likelihood. The syntax is similar to lme4::lmer
, for example
svy2lme(isei~(1+female|id_school)+female+high_school+college+one_for+both_for+test_lang,
data=pisa, p1=1/pisa$wnrschbw,p2=pisa$wnrschbw/pisa$w_fstuwt)
fits a linear mixed model for isei
with a random intercept and random gender effect for schools, and with fixed effects for gender (female
), parents' education (high_school
, college
), immigrant status (one_for
, both_for
), and whether the student speaks the test language at home (test_lang
).
The p1
and p2
(or N2
) arguments specify the sampling design: p1
is the sampling probability for the cluster containing that observation. If p2
is specified, it's the sampling probability for the observation itself given that the cluster is sampled, and estimation uses the approximation that the sampling probability for different observations is independent. Otherwise, N2
is the size of the cluster in the population and the sampling is treated as simple random sampling without replacement.