Package 'MIRES'

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

Help Index


The 'MIRES' package.

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.

References

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>


Fit mixed effects measurement model for invariance assessment.

Description

Fits mixed effects measurement models for measurement invariance assessment.

Usage

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),
  ...
)

Arguments

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 hierarchical, then latent means and (log) SDs are identified as zero-centered random effects. If sum_to_zero, then latent means are identified by a sum-to-zero constraint, and (log) latent SDs are identified by a sum-to-zero constraint.

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 sampling.

Details

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:

p(σpexp(τ))=N+(σp0,exp(τ))p(\sigma_p | \exp(\tau)) = \mathcal{N}^+(\sigma_p | 0, \exp(\tau))

τ=τc+τparam+τitem+τp\tau = \tau_c + \tau_{param} + \tau_{item} + \tau_p

τN(μh,σh)\tau_* \sim \mathcal{N}(\mu_h, \sigma_h)

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 τp\tau_p is included. The prior is then scaled so that the marginal prior on each p(σp)p(\sigma_p) 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.

Value

mires object.

Author(s)

Stephen R. Martin

References

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>

Examples

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

Pairwise comparisons of random parameters.

Description

Compute pairwise differences in group-specific measurement parameters.

Usage

pairwise(
  mires,
  param = c("lambda", "resid", "nu"),
  prob = 0.95,
  less_than = 0.1,
  groups = NULL,
  ...
)

Arguments

mires

mires object.

param

Character. One of lambda (loadings), resid (residual standard deviation on the log scale), or nu (intercepts).

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.

Details

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.

Value

Data frame.

Author(s)

Stephen Martin


Print function for mires objects.

Description

Print function for mires objects.

Usage

## S3 method for class 'mires'
print(x, ...)

Arguments

x

mires object.

...

Not used.

Value

x (Invisibly)

Author(s)

Stephen R. Martin


Print method for MIRES summary objects.

Description

Print method for MIRES summary objects.

Usage

## S3 method for class 'summary.mires'
print(x, ...)

Arguments

x

summary.mires object.

...

Not used.

Value

x (Invisibly)

Author(s)

Stephen Martin


Extract random effects of each group from MIRES model.

Description

Extract random effects of each group from MIRES model.

Usage

## S3 method for class 'mires'
ranef(object, prob = 0.95, ...)

Arguments

object

mires object.

prob

Numeric (Default: .95). Amount of probability mass to contain within the credible interval.

...

Not used.

Value

List containing summaries of lambda, (log) residual SDs, nu, latent mean, and (log) latent SD random effects.

Author(s)

Stephen R Martin


Simulated data: All parameters vary (Full non-invariance)

Description

Simulated data: All parameters vary (Full non-invariance)

Usage

sim_all

Format

A simulated dataset containing eight indicators for one factor, and one grouping variable.


Simulated data: Intercepts vary

Description

Simulated data: Intercepts vary

Usage

sim_intercepts

Format

A simulated dataset containing eight indicators for one factor, and one grouping variable.


Simulated data: Half the items are non-invariant.

Description

Simulated data: Half the items are non-invariant.

Usage

sim_items

Format

A simulated dataset containing eight indicators for one factor, and one grouping variable.


Simulated data: Loadings vary

Description

Simulated data: Loadings vary

Usage

sim_loadings

Format

A simulated dataset containing eight indicators for one factor, and one grouping variable.


Simulated data: No variance (Full invariance)

Description

Simulated data: No variance (Full invariance)

Usage

sim_none

Format

A simulated dataset containing eight indicators for one factor, and one grouping variable.


Simulated data: Residual variances vary

Description

Simulated data: Residual variances vary

Usage

sim_resid

Format

A simulated dataset containing eight indicators for one factor, and one grouping variable.


Summary method for mires object.

Description

Computes summaries for MIRES objects.

Usage

## S3 method for class 'mires'
summary(object, prob = 0.95, less_than = 0.1, ...)

Arguments

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.

Details

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:

BF01

Bayes factor of invariance (Variance = 0) to non-invariance (Variance > 0)

BF10

Bayes factor of non-invariance (Variance > 0) to invariance (Variance = 0). The inverse of BF01 for convenience

Pr(SD <= 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.

BF(SD <= 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.

Value

summary.mires object. List of meta data and summary. Summary is list of summary tables for all fixed effects parameters.

Author(s)

Stephen R. Martin