mixPV: Fit Weighted Multilevel Models Using Plausible Values

View source: R/mixPV.R

mixPVR Documentation

Fit Weighted Multilevel Models Using Plausible Values

Description

Helper function to fit multilevel models with plausible values using weights at different levels using the mix function from the WeMix package (Bailey et al., 2023): see https://cran.r-project.org/web/packages/WeMix/WeMix.pdf.

Usage

mixPV(fml, data = NULL, mc = FALSE, silent = FALSE, ...)

Arguments

fml

The model formula. Multiple plausible values are specified using the form: pv1 + pv2 + pv3 ~ x1 (depending how many PVs are present).

data

Merged dataset to analyze (containing variables at different levels).

mc

Option to use multiple cores to speed up processing (set to FALSE by default).

silent

Option to show which plausible value is being analyzed (set to FALSE by default).

...

Options that are used by the mix function in the WeMix package.

Value

A list object of mix results. Results are pooled using the summary function.

Author(s)

Francis Huang, huangf@missouri.edu

References

Huang, F. (2024). Using plausible values when fitting multilevel models with large-scale assessment data using R. Large-scale Assessments in Education, 12(7). (link)

Examples

## Not run: 
data(pisa2012, package = 'MLMusingR')
m1 <- mixPV(pv1math + pv2math + pv3math + pv4math + pv5math ~ escs + (1|schoolid),
weights = c('w_fstuwt', 'w_fschwt'), data = pisa2012)
summary(m1)

## End(Not run)

MLMusingR documentation built on April 3, 2025, 5:43 p.m.