marker_term: Creates Data for One Type of Marker

View source: R/marker-term.R

marker_termR Documentation

Creates Data for One Type of Marker

Description

Creates Data for One Type of Marker

Usage

marker_term(formula, id, data, time_fixef, time_rng)

Arguments

formula

a two-sided formula with the marker outcome on the left-hand side and fixed effect covariates on the right-hand side.

id

the variable for the id of each individual.

data

a data.frame or environment to look at up the variables in.

time_fixef

the time-varying fixed effects. See .e.g. poly_term.

time_rng

the time-varying random effects. See .e.g. poly_term.

Details

The time_fixef should likely not include an intercept as this is often included in formula. Use poly_term(degree = 0, raw = TRUE, intercept = TRUE) if you want only a random intercept.

Value

An object of class marker_term containing longitudinal data.

Examples

# load in the data
library(survival)
data(pbc, package = "survival")

# re-scale by year
pbcseq <- transform(pbcseq, day_use = day / 365.25)
pbc <- transform(pbc, time_use = time / 365.25)

# create the marker terms
m1 <- marker_term(
  log(bili) ~ 1, id = id, data = pbcseq,
  time_fixef = bs_term(day_use, df = 5L),
  time_rng = poly_term(day_use, degree = 1L, raw = TRUE, intercept = TRUE))
m2 <- marker_term(
  albumin ~ 1, id = id, data = pbcseq,
  time_fixef = bs_term(day_use, df = 5L),
  time_rng = poly_term(day_use, degree = 1L, raw = TRUE, intercept = TRUE))

VAJointSurv documentation built on Aug. 14, 2022, 9:05 a.m.