BIFIE.twolevelreg.Rd
This function computes the hierarchical two level model with random intercepts and random slopes. The full maximum likelihood estimation is conducted by means of an EM algorithm (Raudenbush & Bryk, 2002).
BIFIE.twolevelreg( BIFIEobj, dep, formula.fixed, formula.random, idcluster,
wgtlevel2=NULL, wgtlevel1=NULL, group=NULL, group_values=NULL,
recov_constraint=NULL, se=TRUE, globconv=1E-6, maxiter=1000 )
# S3 method for BIFIE.twolevelreg
summary(object,digits=4,...)
# S3 method for BIFIE.twolevelreg
coef(object,...)
# S3 method for BIFIE.twolevelreg
vcov(object,...)
Object of class BIFIEdata
String for the dependent variable in the regression model
An R formula for fixed effects
An R formula for random effects
Cluster identifier. The cluster identifiers must be
sorted in the BIFIE.data
object.
Name of Level 2 weight variable
Name of Level 1 weight variable. This is optional.
If it is not provided, wgtlevel
is calculated from
the total weight and wgtlevel2
.
Optional grouping variable
Optional vector of grouping values. This can be omitted and grouping values will be determined automatically.
Matrix for constraints of random effects covariance
matrix. The random effects are numbered according to the order in
the specification in formula.random
. The first column in
recov_constraint
contains the row index in the
covariance matrix, the second column the column index and the third column
the value to be fixed.
Optional logical indicating whether statistical inference
based on replication should be employed. In case of se=FALSE
,
standard errors are computed as maximum likelihood estimates under
the assumption of random sampling of level 2 clusters.
Convergence criterion for maximum parameter change
Maximum number of iterations
Object of class BIFIE.twolevelreg
Number of digits for rounding output
Further arguments to be passed
The implemented random slope model can be written as
$$y_{ij}=\bold{X}_{ij} \bold{\gamma} + \bold{Z}_{ij} \bold{u}_j +
\varepsilon_{ij}$$
where \(y_{ij}\) is the dependent variable, \(\bold{X}_{ij}\)
includes the fixed effects predictors (specified by formula.fixed
)
and \(\bold{Z}_{ij}\) includes the random effects predictors
(specified by formula.random
). The random effects \(\bold{u}_j\)
follow a multivariate normal distribution.
The function also computes a variance decomposition of explained variance due to fixed and random effects for the within and the between level. This variance decomposition is conducted for the predictor matrices \(\bold{X}\) and \(\bold{Z}\). It is assumed that \( \bold{X}_{ij}=\bold{X}_j^B + \bold{X}_{ij}^W\). The different sources of variance are computed by formulas as proposed in Snijders and Bosker (2012, Ch. 7).
A list with following entries
Data frame with coefficients and different sources of variance.
Extensive output with all replicated statistics
More values
Raudenbush, S. W., & Bryk, A. S. (2002). Hierarchical linear models: Applications and data analysis methods. Thousand Oaks: Sage.
Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel analysis: An introduction to basic and advanced multilevel modeling. Thousand Oaks: Sage.
The lme4::lmer
function in the lme4 package allows only
weights at the first level.
See the WeMix package (and the function WeMix::mix
) for estimation of
mixed effects models with weights at different levels.