initial_unbalance {MAGMA.R}R Documentation

initial_unbalance

Description

This function computes all four balance criteria of 'MAGMA.R,' namely Pillai's Trace, d-ratiO, mean g, and adjusted d-ratio for the unmatched data set. This enables comparison of initial unbalance with the balance after matching.

Usage

initial_unbalance(
  Data,
  group,
  covariates,
  verbose = TRUE,
  covariates_ordinal = NULL,
  covariates_nominal = NULL
)

Arguments

Data

A data frame containing at least the grouping variable and all covariates of interest.

group

A character specifying the name of your grouping variable in data. Note that MAGMA can only match your data for a maximum of 4 groups. For matching over two grouping variables (e.g., 2x2 design) is possible by specifying group as a character vector with a length of two. In this case each or the two grouping variables can only have two levels.

covariates

A character vector listing the names of all binary and metric covariates of interest.

verbose

TRUE or FALSE indicating whether matching information should be printed to the console.

covariates_ordinal

A character vector listing the names of all ordinal covariates of interest.

covariates_nominal

A character vector listing the names of all nominal covariates of interest.

Details

This function computes all four Balance criteria of 'MAGMA.R', namely Pillai's Trace, d-ratio, mean g, and adjusted d-ratio for the overall samples. Missing data for Pillai's Trace are excluded listwise, while for the other balance criteria pairwise exclusion is applied.

Value

A numeric vector of length 4 containing the balance criteria for the unmatched sample.

Author(s)

Julian Urban

References

Pastore, M., Loro, P.A.D., Mingione, M., Calcagni, A. (2022). overlapping: Estimation of Overlapping in Empirical Distributions. R package version 2.1, (https://CRAN.R-project.org/package=overlapping).

Revelle, W. (2023). psych: Procedures for Psychological, Psychometric, and Personality Research. Northwestern University, Evanston, Illinois. R package version 2.3.6, (https://CRAN.R-project.org/package=psych)

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1-48. (doi:10.18637/jss.v036.i03)

Fisher, Z., Tipton, E., Zhipeng, H. (2023). robumeta: Robust Variance Meta-Regression. R package version 2.1, (https://CRAN.R-project.org/package=robumeta).

Examples

# Defining covariates for balance estimation
covariates_vector <- c("GPA_school", "IQ_score", "Motivation", "parents_academic", "gender")

# Computing initial unbalance using the data set 'MAGMA_sim_data'
# Computing initial unbalance for the variable 'gifted_support' (received
# giftedness support yes or no)
unbalance_gifted <- initial_unbalance(Data = MAGMA_sim_data,
                                      group = "gifted_support",
                                      covariates = covariates_vector)
unbalance_gifted

# Computing initial unbalance using the data set 'MAGMA_sim_data'
# Computing initial unbalance for the variable 'teacher_ability_rating'
# (ability rated from teacher as below average, average, or above average)
unbalance_tar <- initial_unbalance(Data = MAGMA_sim_data,
                                  group = "teacher_ability_rating",
                                  covariates = covariates_vector)
unbalance_tar

# Computing initial unbalance using the data set 'MAGMA_sim_data'
# Computing initial unbalance for the variables 'gifted_support' (received
# giftedness support yes or no) and 'enrichment' (participated in enrichment
# or not)
unbalance_2x2 <- initial_unbalance(Data = MAGMA_sim_data,
                                  group = c("gifted_support", "enrichment"),
                                  covariates = covariates_vector)
unbalance_2x2



[Package MAGMA.R version 1.0.3 Index]