predict.abaModel | R Documentation |
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.
## S3 method for class 'abaModel'
predict(object, ...)
object |
a fitted aba model. The model to get predictions from. |
... |
additional parameters. Accepted: newdata, merge, augment. See
|
a dataframe with original data and with fitted/predicted values added for each group-outcome-stat-predictor combination.
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()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.