This function estimates the estimated marginal means (also known as least-square means) and, if relevant, the treatment effects for mmrm, lme, and ancova models.
abaModel. The fitted aba model to run emmeans on.
This function is based on the
emmeans::emmeans function. This function will
only be run for the stats which are supported by emmeans.
an abaEmmeans object. This object contains the emmeans, the paired comparisons (i.e., treatment effect), and the sample size at each visit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# process data: take first 4 visits, only MCI, use CSF abeta as "treatment", # and create endpoint as change from baseline in cognition at each visit df <- adnimerge %>% dplyr::filter( VISCODE %in% c('bl','m06','m12','m24'), !is.na(CSF_ABETA_STATUS_bl), DX_bl %in% c('MCI') ) %>% dplyr::mutate( TREATMENT = factor(CSF_ABETA_STATUS_bl, levels=c(0,1), labels=c('Placebo','Treatment')), ADAS13 = ADAS13 - ADAS13_bl, CDRSB = CDRSB - CDRSB_bl, MMSE = MMSE - MMSE_bl ) # fit mmrm model for different endpoints, adjusted for covariates model <- df %>% aba_model() %>% set_outcomes(CDRSB, ADAS13, MMSE) %>% set_covariates( AGE, GENDER, EDUCATION ) %>% set_stats( stat_mmrm(id = 'RID', time = 'VISCODE', treatment = 'TREATMENT') ) %>% aba_fit() # run emmeans model_emmeans <- model %>% aba_emmeans()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.