Title: | Information Matrices for 'lmeStruct' and 'glsStruct' Objects |
---|---|
Description: | Provides analytic derivatives and information matrices for fitted linear mixed effects (lme) models and generalized least squares (gls) models estimated using lme() (from package 'nlme') and gls() (from package 'nlme'), respectively. The package includes functions for estimating the sampling variance-covariance of variance component parameters using the inverse Fisher information. The variance components include the parameters of the random effects structure (for lme models), the variance structure, and the correlation structure. The expected and average forms of the Fisher information matrix are used in the calculations, and models estimated by full maximum likelihood or restricted maximum likelihood are supported. The package also includes a function for estimating standardized mean difference effect sizes (Pustejovsky, Hedges, and Shadish (2014) <DOI:10.3102/1076998614547577>) based on fitted lme or gls models. |
Authors: | James Pustejovsky [aut] , Man Chen [aut, cre] |
Maintainer: | Man Chen <[email protected]> |
License: | GPL-3 |
Version: | 0.3.2 |
Built: | 2024-11-06 03:11:23 UTC |
Source: | https://github.com/jepusto/lmeinfo |
Data from a multi-level multiple baseline design conducted by Bryant et al. (2016). The study involved collecting repeated measures of math performance on twelve students nested in three schools. The variables are as follows:
Study_ID
Study identifier.
school
School identifier.
case
Student identifier.
session
Measurement occasion.
treatment
Indicator for treatment phase.
outcome
Texas Early Mathematics Inventory (TEMI-Aim Check) scores.
trt_time
Measurement occasion times treatment phase.
session_c
Measurement occasion centered at the follow-up time (Measurement occasion 9).
A data frame with 299 rows and 8 variables
Bryant, B. R., Bryant, D. P., Porterfield, J., Dennis, M. S., Falcomata, T., Valentine, C., Brewer, C., & Bell, K. (2016). The effects of a Tier 3 intervention on the mathematics performance of second grade students with severe mathematics difficulties. Journal of Learning Disabilities, 49(2), 176-188. doi:10.1177/0022219414538516
Calculates a confidence interval for a g_mlm
object,
using either a central t distribution (for a symmetric interval) or a
non-central t distribution (for an asymmetric interval).
CI_g(g, cover = 0.95, bound = 35, symmetric = TRUE)
CI_g(g, cover = 0.95, bound = 35, symmetric = TRUE)
g |
an estimated effect size object of class |
cover |
confidence level. |
bound |
numerical tolerance for non-centrality parameter in
|
symmetric |
If |
A vector of lower and upper confidence bounds.
library(nlme) data(Bryant2016, package = "lmeInfo") Bryant2016_RML1 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) Bryant2016_g1 <- g_mlm(Bryant2016_RML1, p_const = c(0,1), r_const = c(1,1,0,1), infotype = "expected") CI_g(Bryant2016_g1, symmetric = TRUE) CI_g(Bryant2016_g1, symmetric = FALSE)
library(nlme) data(Bryant2016, package = "lmeInfo") Bryant2016_RML1 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) Bryant2016_g1 <- g_mlm(Bryant2016_RML1, p_const = c(0,1), r_const = c(1,1,0,1), infotype = "expected") CI_g(Bryant2016_g1, symmetric = TRUE) CI_g(Bryant2016_g1, symmetric = FALSE)
Extracts the estimated variance components from a fitted linear mixed effects model (lmeStruct object) or generalized least squares model (glsStruct object).
extract_varcomp(mod, separate_variances, vector)
extract_varcomp(mod, separate_variances, vector)
mod |
Fitted model of class lmeStruct or glsStruct. |
separate_variances |
Logical indicating whether to return the separate
level-1 variance components for each stratum if using |
vector |
Logical indicating whether to return the variance components as
a numeric vector. Default is |
If vector = FALSE
, an object of class varcomp
consisting of a
list of estimated variance components. Models that do not include
correlation structure parameters or variance structure parameters will have
empty lists for those components. If vector = TRUE
, a numeric vector
of estimated variance components.
If separate_variances = TRUE
and if weights =
varIdent(form = ~ 1 | Stratum)
is specified in the model fitting, separate
level-1 variance estimates will be returned for each stratum. If
separate_variances = TRUE
but if the weighting structure is not
specified with varIdent
, or if separate_variances = FALSE
,
then no separate level-1 variance estimates will be returned.
library(nlme) data(Bryant2016) Bryant2016_RML <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) extract_varcomp(Bryant2016_RML, separate_variances = FALSE) extract_varcomp(Bryant2016_RML, separate_variances = TRUE) extract_varcomp(Bryant2016_RML, vector = TRUE)
library(nlme) data(Bryant2016) Bryant2016_RML <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) extract_varcomp(Bryant2016_RML, separate_variances = FALSE) extract_varcomp(Bryant2016_RML, separate_variances = TRUE) extract_varcomp(Bryant2016_RML, vector = TRUE)
Calculates the expected, observed, or average Fisher information matrix from a fitted linear mixed effects model (lmeStruct object) or generalized least squares model (glsStruct object).
Fisher_info(mod, type = "expected", separate_variances = FALSE)
Fisher_info(mod, type = "expected", separate_variances = FALSE)
mod |
Fitted model of class lmeStruct or glsStruct. |
type |
Type of information matrix. One of |
separate_variances |
Logical indicating whether to return the Fisher
information matrix for separate level-1 variance components if using
|
Information matrix corresponding to variance component parameters of
mod
.
If separate_variances = TRUE
and if weights = varIdent(form =
~ 1 | Stratum)
is specified in the model fitting, the Fisher information
matrix for separate level-1 variance estimates will be returned. If
separate_variances = TRUE
but if the weighting structure is not
specified with varIdent
, or if separate_variances = FALSE
,
then the Fisher information matrix for the default variance components will
be returned.
library(nlme) data(Bryant2016) Bryant2016_RML <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) Fisher_info(Bryant2016_RML, type = "expected") Fisher_info(Bryant2016_RML, type = "average") Bryant2016_RML2 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) Fisher_info(Bryant2016_RML2, separate_variances = TRUE)
library(nlme) data(Bryant2016) Bryant2016_RML <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) Fisher_info(Bryant2016_RML, type = "expected") Fisher_info(Bryant2016_RML, type = "average") Bryant2016_RML2 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) Fisher_info(Bryant2016_RML2, separate_variances = TRUE)
Estimates a standardized mean difference effect size from a fitted multi-level model, using restricted or full maximum likelihood methods with small-sample correction, as described in Pustejovsky, Hedges, & Shadish (2014).
g_mlm( mod, p_const, mod_denom = mod, r_const = NULL, infotype = "expected", separate_variances = FALSE, ... )
g_mlm( mod, p_const, mod_denom = mod, r_const = NULL, infotype = "expected", separate_variances = FALSE, ... )
mod |
Fitted model of class lmeStruct (estimated using
|
p_const |
Vector of constants for calculating numerator of effect size.
Must be the same length as fixed effects in |
mod_denom |
Fitted model of class lmeStruct (estimated using
|
r_const |
Vector of constants for calculating denominator of effect
size. Must be the same length as the number of variance component
parameters in |
infotype |
Type of information matrix. One of |
separate_variances |
Logical indicating whether to incorporate separate
level-1 variance components in the calculation of the effect size and
standard error for models with a 'varIdent()' variance structure. If
|
... |
further arguments. |
A list with the following components
p_beta |
Numerator of effect size |
r_theta |
Squared denominator of effect size |
delta_AB |
Unadjusted (mlm) effect size estimate |
nu |
Estimated denominator degrees of freedom |
J_nu
|
Biased correction factor for effect size estimate |
kappa
|
Scaled standard error of numerator |
g_AB |
Corrected effect size estimate |
SE_g_AB |
Approximate standard error estimate |
theta |
Estimated variance component parameters |
info_inv |
Inversed information matrix |
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
library(nlme) data(Bryant2016, package = "lmeInfo") Bryant2016_RML1 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) Bryant2016_g1 <- g_mlm(Bryant2016_RML1, p_const = c(0,1), r_const = c(1,1,0,1), infotype = "expected") print(Bryant2016_g1) summary(Bryant2016_g1) Bryant2016_RML2 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) Bryant_g <- g_mlm(Bryant2016_RML2, p_const = c(0,1), r_const = c(1,1,0,0,1)) Bryant_g_baseline <- g_mlm(Bryant2016_RML2, p_const = c(0,1), r_const = c(1,1,0,1,0), separate_variances = TRUE) Bryant_g_treatment <- g_mlm(Bryant2016_RML2, p_const = c(0,1), r_const = c(1,1,0,0,1), separate_variances = TRUE) print(Bryant_g) print(Bryant_g_baseline) print(Bryant_g_treatment)
library(nlme) data(Bryant2016, package = "lmeInfo") Bryant2016_RML1 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) Bryant2016_g1 <- g_mlm(Bryant2016_RML1, p_const = c(0,1), r_const = c(1,1,0,1), infotype = "expected") print(Bryant2016_g1) summary(Bryant2016_g1) Bryant2016_RML2 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) Bryant_g <- g_mlm(Bryant2016_RML2, p_const = c(0,1), r_const = c(1,1,0,0,1)) Bryant_g_baseline <- g_mlm(Bryant2016_RML2, p_const = c(0,1), r_const = c(1,1,0,1,0), separate_variances = TRUE) Bryant_g_treatment <- g_mlm(Bryant2016_RML2, p_const = c(0,1), r_const = c(1,1,0,0,1), separate_variances = TRUE) print(Bryant_g) print(Bryant_g_baseline) print(Bryant_g_treatment)
Estimate the sampling variance-covariance of variance component parameters from a fitted linear mixed effects model (lmeStruct object) or generalized least squares model (glsStruct object) using the inverse Fisher information.
varcomp_vcov(mod, type = "expected", separate_variances = FALSE)
varcomp_vcov(mod, type = "expected", separate_variances = FALSE)
mod |
Fitted model of class lmeStruct or glsStruct. |
type |
Type of information matrix. One of |
separate_variances |
Logical indicating whether to return the Fisher
information matrix for separate level-1 variance components if using
|
Sampling variance-covariance matrix corresponding to variance
component parameters of mod
.
library(nlme) data(Bryant2016) Bryant2016_RML <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) varcomp_vcov(Bryant2016_RML, type = "expected") Bryant2016_RML2 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) varcomp_vcov(Bryant2016_RML2, separate_variances = TRUE)
library(nlme) data(Bryant2016) Bryant2016_RML <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), data = Bryant2016) varcomp_vcov(Bryant2016_RML, type = "expected") Bryant2016_RML2 <- lme(fixed = outcome ~ treatment, random = ~ 1 | school/case, correlation = corAR1(0, ~ session | school/case), weights = varIdent(form = ~ 1 | treatment), data = Bryant2016) varcomp_vcov(Bryant2016_RML2, separate_variances = TRUE)