g_REML: Calculates adjusted REML effect size

Description Usage Arguments Value References Examples

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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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. doi: 10.3102/1076998614547577

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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)

Example output

Loading required package: nlme
Linear mixed-effects model fit by REML
 Data: Laski 
       AIC      BIC    logLik
  1048.285 1062.466 -519.1424

Random effects:
 Formula: ~1 | case
        (Intercept) Residual
StdDev:    15.68278  13.8842

Correlation Structure: AR(1)
 Formula: ~time | case 
 Parameter estimate(s):
     Phi 
0.252769 
Fixed effects: outcome ~ treatment 
                      Value Std.Error  DF   t-value p-value
(Intercept)        39.07612  5.989138 119  6.524498       0
treatmenttreatment 30.68366  2.995972 119 10.241637       0
 Correlation: 
                   (Intr)
treatmenttreatment -0.272

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.72642154 -0.69387388  0.01454473  0.69861200  2.14528141 

Number of Observations: 128
Number of Groups: 8 
$p_beta
[1] 30.68366

$r_theta
[1] 438.7208

$delta_AB
[1] 1.464917

$nu
         [,1]
[1,] 18.55241

$kappa
          [,1]
[1,] 0.1430354

$g_AB
         [,1]
[1,] 1.404887

$V_g_AB
           [,1]
[1,] 0.08198192

$cnvg_warn
[1] FALSE

$sigma_sq
[1] 192.7711

$phi
[1] 0.252769

$Tau
case.var((Intercept)) 
             245.9497 

$I_E_inv
            [,1]        [,2]          [,3]
[1,]  798.919038  1.32235408  -132.1234581
[2,]    1.322354  0.01002805    -0.5152126
[3,] -132.123458 -0.51521261 20214.7623861

$p_const
[1] 0 1

$r_const
[1] 1 0 1

attr(,"class")
[1] "g_REML"
Linear mixed-effects model fit by REML
 Data: subset(Schutte, case != 4) 
       AIC      BIC    logLik
  930.6238 957.1627 -456.3119

Random effects:
 Formula: ~week | case
 Structure: General positive-definite, Log-Cholesky parametrization
            StdDev    Corr  
(Intercept) 11.599933 (Intr)
week         1.425220 0.81  
Residual     5.281218       

Correlation Structure: AR(1)
 Formula: ~week | case 
 Parameter estimate(s):
      Phi 
0.4043875 
Fixed effects: fatigue ~ week + treatment + trt.week 
                      Value Std.Error  DF   t-value p-value
(Intercept)        51.04822  4.405226 129 11.588106  0.0000
week                0.15649  0.610215 129  0.256450  0.7980
treatmenttreatment -0.26693  1.638464 129 -0.162913  0.8708
trt.week           -1.41456  0.642067 129 -2.203139  0.0294
 Correlation: 
                   (Intr) week   trtmnt
week                0.879              
treatmenttreatment -0.239 -0.199       
trt.week           -0.555 -0.623 -0.153

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.39183384 -0.38039239 -0.05394349  0.31227541  4.20104020 

Number of Observations: 145
Number of Groups: 13 
                               est    se
sigma_sq                     27.89  6.25
phi                           0.40  0.13
case.var((Intercept))       134.56 60.86
case.cov(week,(Intercept))   13.39  7.15
case.var(week)                2.03  1.05
r_theta                     162.45 60.73
(Intercept)                  51.05  4.41
week                          0.16  0.61
treatmenttreatment           -0.27  1.64
trt.week                     -1.41  0.64
p_beta                      -10.17  4.54
unadjusted                   -0.80  0.42
adjusted                     -0.76  0.40
df                           14.31    NA
kappa                         0.36    NA
logLik                     -456.31    NA

scdhlm documentation built on Jan. 13, 2021, 7:10 p.m.