This function allows you to get the fitted/predicted values from data
used to fit an aba model or from new data. This is essentially an extension
of the broom::augment()
function.
Usage
# S3 method for abaModel
predict(object, ...)
Arguments
- object
a fitted aba model. The model to get predictions from.
- ...
additional parameters. Accepted: newdata, merge, augment. See
aba_fit()
for more information.
Value
a dataframe with original data and with fitted/predicted values added for each group-outcome-stat-predictor combination.
Examples
data <- adnimerge %>% dplyr::filter(VISCODE == 'bl')
model <- data %>% aba_model() %>%
set_groups(
everyone(),
DX_bl %in% c('MCI', 'AD')
) %>%
set_outcomes(CDRSB_bl, MMSE_bl) %>%
set_predictors(
PLASMA_PTAU181_bl, PLASMA_NFL_bl,
c(PLASMA_PTAU181_bl, PLASMA_NFL_bl)
) %>%
set_covariates(AGE, GENDER, EDUCATION) %>%
set_stats('lm')
model <- model %>% fit()
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION + PLASMA_NFL_bl"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl + PLASMA_NFL_bl"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION + PLASMA_NFL_bl"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl + PLASMA_NFL_bl"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION + PLASMA_NFL_bl"
#> [1] "CDRSB_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl + PLASMA_NFL_bl"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION + PLASMA_NFL_bl"
#> [1] "MMSE_bl ~ AGE + GENDER + EDUCATION + PLASMA_PTAU181_bl + PLASMA_NFL_bl"
# add model predictions to original data
data_augmented <- model %>% aba_predict()
# store predictions separately by group - outcome - stat combination
data_augmented2 <- model %>% aba_predict(merge = FALSE)