g_REML: Calculates adjusted REML effect size

View source: R/REML-ES-functions.R

g_REMLR Documentation

Calculates adjusted REML effect size

Description

Estimates a design-comparable standardized mean difference effect size based on data from a multiple baseline design, using adjusted REML method as described in Pustejovsky, Hedges, & Shadish (2014). Note that the data must contain one row per measurement occasion per case.

Usage

g_REML(
  m_fit,
  p_const,
  r_const,
  X_design = model.matrix(m_fit, data = m_fit$data),
  Z_design = model.matrix(m_fit$modelStruct$reStruct, data = m_fit$data),
  block = nlme::getGroups(m_fit),
  times = attr(m_fit$modelStruct$corStruct, "covariate"),
  returnModel = TRUE
)

Arguments

m_fit

Fitted model of class lme, with AR(1) correlation structure at level 1.

p_const

Vector of constants for calculating numerator of effect size. Must be the same length as fixed effects in m_fit.

r_const

Vector of constants for calculating denominator of effect size. Must be the same length as the number of variance component parameters in m_fit.

X_design

(Optional) Design matrix for fixed effects. Will be extracted from m_fit if not specified.

Z_design

(Optional) Design matrix for random effects. Will be extracted from m_fit if not specified.

block

(Optional) Factor variable describing the blocking structure. Will be extracted from m_fit if not specified.

times

(Optional) list of times used to describe AR(1) structure. Will be extracted from m_fit if not specified.

returnModel

(Optional) If true, the fitted input model is included in the return.

Value

A list with the following components

p_beta Numerator of effect size
r_theta Squared denominator of effect size
delta_AB Unadjusted (REML) effect size estimate
nu Estimated denominator degrees of freedom
kappa Scaled standard error of numerator
g_AB Corrected effect size estimate
V_g_AB Approximate variance estimate
cnvg_warn Indicator that model did not converge
sigma_sq Estimated level-1 variance
phi Estimated autocorrelation
Tau Vector of level-2 variance components
I_E_inv Expected information matrix

References

Pustejovsky, J. E., Hedges, L. V., & Shadish, W. R. (2014). Design-comparable effect sizes in multiple baseline designs: A general modeling framework. Journal of Educational and Behavioral Statistics, 39(4), 211-227. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3102/1076998614547577")}

Examples

data(Laski)
Laski_RML <- lme(fixed = outcome ~ treatment, 
                 random = ~ 1 | case, 
                 correlation = corAR1(0, ~ time | case), 
                 data = Laski)
summary(Laski_RML)
g_REML(Laski_RML, p_const = c(0,1), r_const = c(1,0,1), returnModel=FALSE)

data(Schutte)
Schutte$trt.week <- with(Schutte, unlist(tapply((treatment=="treatment") * week, 
         list(treatment,case), function(x) x - min(x))) + (treatment=="treatment"))
Schutte$week <- Schutte$week - 9
Schutte_RML <- lme(fixed = fatigue ~ week + treatment + trt.week, 
                   random = ~ week | case, 
                   correlation = corAR1(0, ~ week | case), 
                   data = subset(Schutte, case != 4))
summary(Schutte_RML)
Schutte_g <- g_REML(Schutte_RML, p_const = c(0,0,1,7), r_const = c(1,0,1,0,0))
summary(Schutte_g)

jepusto/scdhlm documentation built on Feb. 27, 2024, 4:45 p.m.