aba_plot_trajectory: Plot trajectories of fitted longitudinal stats

View source: R/aba_grid.R

aba_plot_trajectoryR Documentation

Plot trajectories of fitted longitudinal stats

Description

level=0: group-level estimates level=1: individual-level estimates level=2: individual-level observations

Usage

aba_plot_trajectory(
  model,
  time_at = NULL,
  at = NULL,
  expand = NULL,
  reduce_fn = mean,
  include_ranef = FALSE,
  time_label = "Time",
  outcome_label = "Outcome",
  include_basic = TRUE
)

Arguments

level

Examples

data <- aba::adnimerge %>%
  filter(
    AGE > 20,
    YEARS_bl <= 3.5,
    DX_bl == 'MCI'
  )
data_bl <- data %>% filter(VISCODE == 'bl')

model <- data %>%
  aba_model() %>%
  set_outcomes(ADAS13, CDRSB) %>%
  set_predictors(c(AGE, CSF_ABETA_bl)) %>%
  set_stats(
    stat_lme(id = 'RID', time = 'YEARS_bl', poly=2)
  ) %>%
  fit()

model %>%
  aba_plot_trajectory(
    time_at=seq(0,3,length.out=20)
  )

model %>%
  aba_plot_trajectory(
    time_at=seq(0,3,length.out=20),
    include_ranef = T
  )


# two different stats
model <- data %>%
  aba_model() %>%
  set_outcomes(ADAS13, CDRSB) %>%
  set_predictors(c(AGE, CSF_ABETA_bl)) %>%
  set_stats(
    stat_lme(id = 'RID', time = 'YEARS_bl'),
    stat_lme(id = 'RID', time = 'YEARS_bl', poly=2)
  ) %>%
  fit()

# two different stats
model %>%
  aba_plot_trajectory(
    time_at=seq(0,3,length.out=20),
    include_ranef = T
  )

# two stats and "at" vars
model %>%
  aba_plot_trajectory(
    time_at=seq(0,3,length.out=20),
    include_ranef = T,
    at = list('AGE'=c(50,80))
  )


ncullen93/abaR documentation built on Feb. 8, 2024, 12:01 p.m.