This function lets you evaluate the performance of a fitted aba model on new data.
Arguments
- model
a fitted aba model. The model to test on new data
- data
dataframe. The new data on which the fitted model will be tested.
Examples
# create separate training and testing datasets
data <- adnimerge %>% dplyr::filter(VISCODE == 'bl')
train_id <- sample(nrow(data), 0.8*nrow(data), replace = FALSE)
data_train <- data %>% dplyr::filter(dplyr::row_number() %in% train_id)
data_test <- data %>% dplyr::filter(dplyr::row_number() %in% train_id)
# fit model on train data
model <- aba_model() %>%
set_data(data_train) %>%
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') %>%
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"
# evaluate fitted model on test data
res <- model %>% aba_evaluate(data = data_test)