interpolate_date: Interpolate kidney function via a linear mixed effects model

Description Usage Arguments Value Examples

View source: R/interpolate_date.R

Description

Interpolate kidney function via a linear mixed effects model

Usage

1
interpolate_date(fit, egfr, id, origin, time_scale)

Arguments

fit

A mixed model fitted using lme4::lmer().

egfr

Interpolation identifies the date at which egfr is reached. Can be a vector or a single value.

id

Name of the ID variable used to identify each study subject.

origin

Origin of the time scale. Can be a vector of dates or a single value.

time_scale

Time scale used for the calculations; can be either "years" or "days".

Value

A data frame with a row per subject and a column per egfr value.

Examples

1
2
3
4
5
6
7
8
9
df <- simulate_long_egfr(n = 100)
model <- lme4::lmer(egfr ~ time + (time | lopnr), data = df)
interpolate_date(
  fit = model,
  id = "lopnr",
  egfr = c(60, 30),
  origin = as.Date("2006-01-01"),
  time_scale = "years"
)

ellessenne/SCREAM documentation built on Dec. 20, 2021, 4:19 a.m.