Description Usage Arguments Value Examples
An aba model is the foundational object in the aba package. It is composed of the following:
data: a data.frame to be used to fit the statistical models
spec: the specification for the aba model composed of the following:
groups: subsets of the data
outcomes: dependent variables in statistical fits.
covariates: independent variables which should always be included in statistical fits.
predictors: independent variables which will vary across different statistical fits.
results: the resulting fitted statistics.
1 2 3 4 5 6 7 8 9 |
data |
data.frame the data to use for the object |
groups |
vector or list of logical statements as trings. Groups are subsets of the data on which different models will be fit. |
outcomes |
vector or list of strings Outcomes are the dependent variables in the statistical fits. |
predictors |
vector or list of strings Predictors are independent
variables which you want to vary. You can include variables on their own
or in combination with others. A collection of variables is referred to as
a |
covariates |
vector of strings Covariates are independent variables which remain fixed across all statistical fits and are therefore always included with the different combinations of predictors. |
stats |
string or abaStat object(s) with |
verbose |
logical. Whether to give a progress bar during model fitting. This can be useful if the fitting procedure is going to take a long time. |
An aba model which can be fitted using the aba_fit()
function and
which can be modified in any manner.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # use built-in data and only take the baseline visit
data <- adnimerge %>% dplyr::filter(VISCODE == 'bl')
# Create aba model w/ data, groups, outcomes, covariates, predictors, stats.
# Note that we start with piping the data into the aba_model... This is
# possible because `data` is the first argument of the `aba_model()` function
# and is useful because it gives auto-completion of variables names in Rstudio.
model <- data %>% aba_model() %>%
set_groups(everyone(), DX_bl %in% c('MCI','AD')) %>%
set_outcomes(ConvertedToAlzheimers, CSF_ABETA_STATUS_bl) %>%
set_covariates(AGE, GENDER, EDUCATION) %>%
set_predictors(
PLASMA_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl,
c(PLASMA_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl)
) %>%
set_stats('glm')
# get a useful view of the model spec:
print(model)
# model specs can be modified to build on one another and save time when
# doing sensitivity analyses. Here, we create the same model as before but
# just add APOE4 as covariate.
model2 <- model %>%
set_covariates(AGE, GENDER, EDUCATION, APOE4)
# see this change in the model print
print(model2)
# Calling the `fit()` function actually triggers fitting of statistics.
model <- model %>% fit()
model2 <- model2 %>% fit()
# Access the raw results in case you care about that:
print(model$results)
# Calling the `summary()` function summarises covariates and metrics in
# a useful manner
model_summary <- model %>% summary()
model2_summary <- model2 %>% summary()
# see a nicely formatted print out of the summary
print(model_summary)
# or access the raw summary results:
print(model_summary$results)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.