stat_lme: Create an lme stat object.

Description Usage Arguments Value Examples

View source: R/stat_lme.R

Description

This function creates an lme stat object which can be passed as input to the set_stats() function when building an aba model. This stat performs a linear mixed effects model analysis using the lme function from the nlme package. Please note that the default mode is to include an interaction term between the time variable and each predictor - i.e., time*predictor will be in the model formula - but this does not happen for covariates. Also, this model fits random intercepts and random slopes. The data for this model should be in long format with one row per subject-visit.

Usage

1
stat_lme(id, time, std.beta = FALSE, complete.cases = TRUE)

Arguments

id

string. This is the variable in the data which represents the subject id to be used for random intercepts and random slopes.

time

string. This is the time variable in the data which represents the time from baseline that the visit occured.

std.beta

logical. Whether to standardize model predictors and covariates prior to analysis.

complete.cases

logical. Whether to only include the subset of data with no missing data for any of the outcomes, predictors, or covariates. Note that complete cases are considering within each group - outcome combination but across all predictor sets.

Value

An abaStat object with lme stat type.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data <- adnimerge %>%
  dplyr::filter(VISCODE %in% c('bl','m06','m12','m24'))

model <- data %>% aba_model() %>%
  set_groups(
    everyone(),
    DX_bl %in% c('MCI', 'AD')
  ) %>%
  set_outcomes(CDRSB, ADAS13) %>%
  set_predictors(
    PLASMA_ABETA_bl,
    PLASMA_PTAU181_bl,
    PLASMA_NFL_bl,
    c(PLASMA_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl)
  ) %>%
  set_covariates(AGE, GENDER, EDUCATION) %>%
  set_stats(
    stat_lme(id = 'RID', time = 'YEARS_bl')
  ) %>%
  fit()

model_summary <- model %>% aba_summary()

aba documentation built on Dec. 17, 2021, 1:06 a.m.