Title: | Measurement Invariance Assessment Using Random Effects Models and Shrinkage |
---|---|
Description: | Estimates random effect latent measurement models, wherein the loadings, residual variances, intercepts, latent means, and latent variances all vary across groups. The random effect variances of the measurement parameters are then modeled using a hierarchical inclusion model, wherein the inclusion of the variances (i.e., whether it is effectively zero or non-zero) is informed by similar parameters (of the same type, or of the same item). This additional hierarchical structure allows the evidence in favor of partial invariance to accumulate more quickly, and yields more certain decisions about measurement invariance. Martin, Williams, and Rast (2020) <doi:10.31234/osf.io/qbdjt>. |
Authors: | Stephen Martin [aut, cre] , Philippe Rast [aut] |
Maintainer: | Stephen Martin <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-10-26 05:12:03 UTC |
Source: | https://github.com/stephensrmmartin/mires |
Estimates random effect latent measurement models, wherein the loadings, residual variances, intercepts, latent means, and latent variances all vary across groups. The random effect variances of the measurement parameters are then modeled using a hierarchical inclusion model, wherein the inclusion of the variances (i.e., whether it is effectively zero or non-zero) is informed by similar parameters (of the same type, or of the same item). This additional hierarchical structure allows the evidence in favor of partial invariance to accumulate more quickly, and yields more certain decisions about measurement invariance.
Stan Development Team (2020). RStan: the R interface to Stan. R package version 2.21.1. https://mc-stan.org
Martin, S. R., Williams, D. R., & Rast, P. (2019, June 18). Measurement Invariance Assessment with Bayesian Hierarchical Inclusion Modeling. <doi:10.31234/osf.io/qbdjt>
Fits mixed effects measurement models for measurement invariance assessment.
mires( formula, group, data, inclusion_model = c("dependent", "independent"), identification = c("sum_to_zero", "hierarchical"), save_scores = FALSE, prior_only = FALSE, prior = c(0, 0.25), ... )
mires( formula, group, data, inclusion_model = c("dependent", "independent"), identification = c("sum_to_zero", "hierarchical"), save_scores = FALSE, prior_only = FALSE, prior = c(0, 0.25), ... )
formula |
Formula. LHS is the factor name, and RHS contains indicators. |
group |
Grouping variable (symbol). Grouping variable over which to assess invariance. |
data |
data.frame. Must contain the indicators specified in formula, and the grouping variable. |
inclusion_model |
String (Default: dependent). If dependent, then the regularization of RE-SDs are dependent (See Details). If independent, then regularization is per-parameter. This is useful for comparing a dependent inclusion model to a non-dependent inclusion model. Note that adaptive regularization occurs regardless (until a non-regularized version is implemented). |
identification |
String (Default: sum_to_zero). If |
save_scores |
Logical (Default: FALSE). If TRUE, latent scores for each observation are estimated. If FALSE (Default), latent scores are marginalized out; this can result in more efficient sampling and faster fits, due to the drastic reduction in estimated parameters. Note that the random effects for each group are always estimated, and are not marginalized out. |
prior_only |
Logical (Default: FALSE). If TRUE, samples are drawn from the prior. |
prior |
Numeric vector (Default: c(0, .25)). The location and scale parameters for the hierarchical inclusion model. |
... |
Further arguments to |
MIRES stands for Measurement Invariance assessment with Random Effects and Shrinkage. Unlike other measurement invariance approaches, the MIRES model assumes all measurement model parameters (loadings, residual SDs, and intercepts) can randomly vary across groups — It is a mixed effects model on all parameters. Unlike most mixed effects models, the random effect variances are themselves also hierarchically modeled from a half-normal distribution with location zero, and a scaling parameter. This scaling parameter allows for rapid shrinkage of variance toward zero (invariance), while allowing variance if deemed necessary (non-invariance).
The scaling parameter (an estimated quantity) controls whether the RE variance is effectively zero (invariant) or not (non-invariant).
Therefore, the random effect variances are regularized.
When inclusion_model
is dependent
(Default), the scaling parameters are hierarchically modeled.
By doing so, the invariance or non-invariance of a parameter is informed by other parameters with shared characteristics.
Currently, we assume that each parameter informs the invariance of other similar parameters (presence of variance in some loadings increases the probability of variance in other loadings), and of similar items (non-invariance of item j parameters informs other parameters for item j).
This approach increases the information available about presence or absence of invariance, allowing for more certain decisions.
The "Hierarchical inclusion model" on the random effect variance manifests as a hierarchical prior. When a dependent inclusion model is specified, then the hierarchical prior on random effect SDs is:
Therefore, the regularization of each RE-SD is shared between all RE-SDs (tau_c), all RE-SDs of the same parameter type (tau_param), and all RE-SDs of the same item (tau_item).
When an independent inclusion model is specified (inclusion_model
is "independent"), only the independent regularization term is included.
The prior is then scaled so that the marginal prior on each
remains the same.
In this case, RE-SDs cannot share regularization intensities between one another.
The inclusion model hyper parameters (mu_h, sigma_h) can be specified, but we recommend the default as a relatively sane, but weakly informative prior.
mires object.
Stephen R. Martin
Stan Development Team (2020). RStan: the R interface to Stan. R package version 2.21.1. https://mc-stan.org
Martin, S. R., Williams, D. R., & Rast, P. (2019, June 18). Measurement Invariance Assessment with Bayesian Hierarchical Inclusion Modeling. <doi:10.31234/osf.io/qbdjt>
data(sim_loadings) # Load simulated data set head(sim_loadings) # 8 indicators, grouping variable is called "group" # Fit MIRES to simulated data example. # Assume factor name is, e.g., agreeableness. fit <- mires(agreeableness ~ x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8, group = group, data = sim_loadings, chains = 2, cores = 2) # Summarize fit summary(fit) # Compare all groups' loadings: pairwise(fit, param = "lambda") # Compare groups "2" and "3" only: pairwise(fit, param = "lambda", groups = c("2", "3")) # Get random effects: fit_ranefs <- ranef(fit) # Look at random effects of loadings: fit_ranefs$lambda
data(sim_loadings) # Load simulated data set head(sim_loadings) # 8 indicators, grouping variable is called "group" # Fit MIRES to simulated data example. # Assume factor name is, e.g., agreeableness. fit <- mires(agreeableness ~ x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8, group = group, data = sim_loadings, chains = 2, cores = 2) # Summarize fit summary(fit) # Compare all groups' loadings: pairwise(fit, param = "lambda") # Compare groups "2" and "3" only: pairwise(fit, param = "lambda", groups = c("2", "3")) # Get random effects: fit_ranefs <- ranef(fit) # Look at random effects of loadings: fit_ranefs$lambda
Compute pairwise differences in group-specific measurement parameters.
pairwise( mires, param = c("lambda", "resid", "nu"), prob = 0.95, less_than = 0.1, groups = NULL, ... )
pairwise( mires, param = c("lambda", "resid", "nu"), prob = 0.95, less_than = 0.1, groups = NULL, ... )
mires |
mires object. |
param |
Character. One of |
prob |
Numeric (0-1). Probability mass contained within the highest density interval. |
less_than |
Numeric (Default: .1; positive). Value at which to assess Pr(|difference| < less_than|D). |
groups |
Character vector (Optional). If specified, will only compute pairwise differences of the specified groups. |
... |
Not used. |
For a specified set of parameters, this computes all pairwise differences in the random effects across the posterior. Specifically, this computes the posterior differences of groups' parameters, for all parameters. This is useful for comparing groups' estimates under non-invariance.
Data frame.
Stephen Martin
Print function for mires objects.
## S3 method for class 'mires' print(x, ...)
## S3 method for class 'mires' print(x, ...)
x |
mires object. |
... |
Not used. |
x (Invisibly)
Stephen R. Martin
Print method for MIRES summary objects.
## S3 method for class 'summary.mires' print(x, ...)
## S3 method for class 'summary.mires' print(x, ...)
x |
summary.mires object. |
... |
Not used. |
x (Invisibly)
Stephen Martin
Extract random effects of each group from MIRES model.
## S3 method for class 'mires' ranef(object, prob = 0.95, ...)
## S3 method for class 'mires' ranef(object, prob = 0.95, ...)
object |
mires object. |
prob |
Numeric (Default: .95). Amount of probability mass to contain within the credible interval. |
... |
Not used. |
List containing summaries of lambda, (log) residual SDs, nu, latent mean, and (log) latent SD random effects.
Stephen R Martin
Simulated data: All parameters vary (Full non-invariance)
sim_all
sim_all
A simulated dataset containing eight indicators for one factor, and one grouping variable.
Simulated data: Intercepts vary
sim_intercepts
sim_intercepts
A simulated dataset containing eight indicators for one factor, and one grouping variable.
Simulated data: Half the items are non-invariant.
sim_items
sim_items
A simulated dataset containing eight indicators for one factor, and one grouping variable.
Simulated data: Loadings vary
sim_loadings
sim_loadings
A simulated dataset containing eight indicators for one factor, and one grouping variable.
Simulated data: No variance (Full invariance)
sim_none
sim_none
A simulated dataset containing eight indicators for one factor, and one grouping variable.
Simulated data: Residual variances vary
sim_resid
sim_resid
A simulated dataset containing eight indicators for one factor, and one grouping variable.
Computes summaries for MIRES objects.
## S3 method for class 'mires' summary(object, prob = 0.95, less_than = 0.1, ...)
## S3 method for class 'mires' summary(object, prob = 0.95, less_than = 0.1, ...)
object |
mires object. |
prob |
Numeric (Default = .95). Probability mass to be contained in the highest posterior density interval. |
less_than |
Numeric (Default: .1; positive). Value at which to assess Pr(SD < less_than|D). |
... |
Not used. |
Computes summary tables for fixed measurement parameters (loadings, residual SDs, and intercepts) and random effect standard deviations (resd). The printed output includes the posterior mean, median, SD, and .95 (Default) highest density intervals. HDIs were chosen instead of quantile intervals because the random effect SDs can be on the boundary of zero if invariance is plausible. Additionally, other columns exist to help aid decisions about invariance:
Bayes factor of invariance (Variance = 0) to non-invariance (Variance > 0)
Bayes factor of non-invariance (Variance > 0) to invariance (Variance = 0). The inverse of BF01 for convenience
less_than
)The posterior probability that the random effect SD is less than less_than
(Default: .1). Set less_than
to a value below which you would consider the variance to be effectively ignorable.
less_than
)The Bayes Factor comparing effectively-invariant (SD < less_than
) to non-invariant (SD > less_than
). Set less_than
to a value below which you would consider variance to be effectively ignorable. This uses the encompassing prior approach.
summary.mires object. List of meta data and summary. Summary is list of summary tables for all fixed effects parameters.
Stephen R. Martin