stat_retest: Create a retest stat object.

Description Usage Arguments Value Examples

View source: R/stat_retest.R

Description

This function creates a retest stat object which can be passed as input to the set_stats() function when building an aba model. This stat performs a test-retest analysis on data in long format. It can be used to calculate the bias and variance of biomarkers (or any variables, for that matter) when measured multiple times. Moreover, the result of a model fit with this stat can be subsequently passed to the aba_robust() object in order to test the effect of test-retest bias/variance on clinical prediction models which can also be fit as an aba model.

Usage

1
2
3
4
5
6
7
stat_retest(
  id,
  time,
  method = c("percent_change"),
  std.beta = FALSE,
  complete.cases = FALSE
)

Arguments

id

string. This is the subject id variable in the dataset. This is necessary to keep track of which values belong to which individuals.

time

string. This is the time variable in the dataset. This is necessary to keep track of which values belong to which time point.

method

string. This is the method used to calculate the difference between outcome values across time points. Options are: percent_change calculated by 100 * (x - y) / y where x is the earlier time and y is the later time.

std.beta

logical. Whether to standardize the model outcomes and predictors/outcomes prior to analysis.

complete.cases

logical. Whether to only include the subset of data with no missing data for any of the outcomes, predictors, or covariates. Note that complete cases are considering within each group - outcome combination but across all predictor sets.

Value

An abaStat object with retest stat type.

Examples

 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
# use longitudinal data in healthy controls as pseudo "test-retest"
data <- adnimerge %>%
  dplyr::filter(
    VISCODE %in% c('bl' ,'m06', 'm12'),
    DX_bl == 'CU'
  )

# fit model over two groups and two endpoints
model <- data %>% aba_model() %>%
  set_groups(
    everyone(),
    CSF_ABETA_STATUS_bl == 1,
    labels = c('CU', 'CU AB-')
  ) %>%
  set_outcomes(
    ADAS13, MMSE,
    labels = c('ADAS13', 'MMSE')
  ) %>%
  set_stats(
    stat_retest(id = 'RID', time = 'VISCODE')
  ) %>%
  aba_fit()

# summarise model to get bias and variance estimates
model_summary <- model %>% aba_summary()

# plot model results like any other summary
g <- model_summary %>% aba_plot_coef(
  x='term', group='group', facet=c('outcome','predictor'), coord_flip=TRUE
)

aba documentation built on Dec. 17, 2021, 1:06 a.m.