simulate_long_egfr: Simulate longitudinal eGFR data

Description Usage Arguments Value Examples

View source: R/simulate_long_egfr.R

Description

Simulate longitudinal eGFR data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
simulate_long_egfr(
  n,
  id = "lopnr",
  fixed_intercept = 100,
  fixed_slope = -1,
  B = matrix(data = c(100, 10, 10, 5), nrow = 2, ncol = 2),
  sigma = 10,
  lambda = 1,
  size = 1,
  prob = 0.1,
  origin = NULL
)

Arguments

n

Number of observations.

id

Name of the ID variable that will be used throughout.

fixed_intercept

Fixed intercept.

fixed_slope

Fixed slope.

B

Variance-covariance matrix of the random effects.

sigma

Standard deviation of the residual error term.

lambda

Parameter lambda of the baseline hazard for the exponential survival model.

size

Parameter 'size' for the negative binomial distribution; see stats::dnbinom().

prob

Parameter 'prob' for the negative binomial distribution; see stats::dnbinom().

origin

If origin = NULL (the default), observation times are relative to a time zero. Otherwise, if a date is passed to origin, all dates are re-calculated relative to it.

Value

A data frame with simulate data for n subjects.

Examples

1
2
3
4
5
6
7
set.seed(42)
df <- simulate_long_egfr(n = 3)
df

set.seed(42)
df <- simulate_long_egfr(n = 3, origin = as.Date("2006-01-01"))
df

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