aba_grid | R Documentation |
This function calculates a reference grid for each fitted result in an
aba model based on specified parameters (see emmeans::ref_grid
for examples).
The predictions and standard errors from the fitted result are also included
in the grid by default
aba_grid(model, at = NULL, expand = NULL, reduce_fn = mean)
model |
aba model. The fitted aba model on which to compute a reference grid. |
at |
named list of vectors. A named list where the name is a variable in the model and the value is a vector of values which should be included in the list. |
expand |
character vector. Variables in the model for which all observed values of the variable should be included in the grid. |
reduce_fn |
function. Any variables not in |
dataframe
# get data
data <- aba::adnimerge %>%
filter(
AGE > 20,
YEARS_bl <= 3.5,
DX_bl == 'MCI'
)
data_bl <- data %>% filter(VISCODE == 'bl')
model <- data_bl %>%
aba_model() %>%
set_outcomes(ADAS13_bl, CDRSB_bl) %>%
set_predictors(
c(AGE, EDUCATION),
AGE
) %>%
set_stats('lm') %>%
fit()
model_grid <- model %>% aba_grid(at = list('AGE' = c(70, 80, 90)))
# All observed values of 'EDUCATION' will be included in the grid
# For all other vars ('AGE'), a 4-val seq spaced from min-max will be included
model_grid <- model %>% aba_grid(
expand = c('EDUCATION'),
reduce_fn = function(x) { seq(min(x), max(x), length.out=4) }
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.