mixed.sdf {EdSurvey} | R Documentation |
EdSurvey Mixed-Effects Model
Description
Fits a linear weighted mixed-effects model.
Usage
mixed.sdf(
formula,
data,
weightVars = NULL,
weightTransformation = TRUE,
recode = NULL,
defaultConditions = TRUE,
tolerance = 0.01,
nQuad = NULL,
verbose = 0,
family = NULL,
centerGroup = NULL,
centerGrand = NULL,
fast = FALSE,
...
)
Arguments
formula |
a |
data |
an |
weightVars |
character vector indicating weight variables for
corresponding levels to use. The |
weightTransformation |
a logical value to indicate whether the function
should standardize weights before using it in the
multilevel model. If set to |
recode |
a list of lists to recode variables. Defaults to |
defaultConditions |
a logical value. When set to the default value of
|
tolerance |
depreciated, no effect |
nQuad |
depreciated, no effect |
verbose |
an integer; when set to |
family |
this argument is depreciated; please use the |
centerGroup |
a list in which the name of each element is the name of the aggregation level,
and the element is a formula of variable names to be group mean centered. For example, to group mean center
gender and age within the group student: |
centerGrand |
a formula of variable names to be grand mean centered. For example, to center the
variable education by overall mean of education: |
fast |
depreciated, no effect |
... |
other potential arguments to be used in |
Details
This function uses the mix
call in the WeMix
package to fit mixed models.
When the outcome does not have plausible values, the variance estimator directly from
the mix
function is used; these account for covariance at the top level
of the model specified by the user.
When the outcome has plausible values, the coefficients are estimated in the same
way as in lm.sdf
, that is, averaged across the plausible values.
In addition, the variance of the coefficients is estimated
as the sum of the variance estimate from the mix
function and the
imputation variance. The formula for the imputation variance is, again, the same
as for lm.sdf
,
with the same estimators as in the vignette titled
Statistical Methods Used in EdSurvey.
In the section
“Estimation of Standard Errors of Weighted Means When Plausible Values Are Present, Using the Jackknife Method”
in the formula for V_{imp}
, the variance
and estimates of the variance components are estimated with the same formulas as
the regression coefficients.
Value
A mixedSdfResults
object with the following elements:
call |
the original call used in |
formula |
the formula used to fit the model |
coef |
a vector of coefficient estimates |
se |
a vector with the standard error estimates of the coefficients and the standard error of the variance components |
vars |
estimated variance components of the model |
levels |
the number of levels in the model |
ICC |
the intraclass correlation coefficient of the model |
npv |
the number of plausible values |
ngroups |
a |
n0 |
the number of observations in the original data |
nused |
the number of observations used in the analysis |
model.frame |
the data used in the model |
If the formula does not involve plausible values, the function will return the following additional elements:
lnlf |
the likelihood function |
lnl |
the log-likelihood of the model |
If the formula involves plausible values, the function will return the following additional elements:
Vimp |
the estimated variance from uncertainty in the scores |
Vjrr |
the estimated variance from sampling |
Author(s)
Paul Bailey, Trang Nguyen, and Claire Kelley
References
Rabe-Hesketh, S., & Skrondal, A. (2006). Multilevel modelling of complex survey data. Journal of the Royal Statistical Society: Series A (Statistics in Society), 169(4), 805–827.
See Also
Examples
## Not run:
# save TIMSS 2015 data to ~/TIMSS/2015
downloadTIMSS(root="~/", years=2015)
fin <- readTIMSS(path="~/TIMSS/2015", countries="fin", gradeLvl=4)
# uses all plausible values
mix1 <- mixed.sdf(formula=mmat ~ itsex + (1|idschool), data = fin,
weightVar=c("totwgt","schwgt"), weightTransformation=FALSE)
summary(mix1)
# uses only one plausible value
mix2 <- mixed.sdf(formula=asmmat01 ~ itsex + (1|idschool), data = fin,
weightVar=c("totwgt","schwgt"), weightTransformation=FALSE)
summary(mix2)
## End(Not run)