Create an input data frame X for simulated data

sim.create_x(
  N,
  covariates,
  names,
  n_categs,
  t_data,
  t_jitter,
  t_effect_range,
  continuous_info
)

Arguments

N

Number of individuals.

covariates

Integer vector that defines the types of covariates (other than id and age). If not given, only the id and age covariates are created. Different integers correspond to the following covariate types:

  • 0 = disease-related age

  • 1 = other continuous covariate

  • 2 = a categorical covariate that interacts with age

  • 3 = a categorical covariate that acts as a group offset

  • 4 = a categorical covariate that that acts as a group offset AND is restricted to have value 0 for controls and 1 for cases

names

Covariate names.

n_categs

An integer vector defining the number of categories for each categorical covariate, so that length(n_categs) equals to the number of 2's and 3's in the covariates vector.

t_data

Measurement times (same for each individual, unless t_jitter > 0 in which case they are perturbed).

t_jitter

Standard deviation of the jitter added to the given measurement times.

t_effect_range

Time interval from which the disease effect times are sampled uniformly. Alternatively, This can any function that returns the (possibly randomly generated) real disease effect time for one individual.

continuous_info

Info for generating continuous covariates. Must be a list containing fields lambda and mu, which have length 3. The continuous covariates are generated so that x <- sin(a*t + b) + c, where

  • t <- seq(0, 2*pi, length.out = k)

  • a <- mu[1] + lambda[1]*stats::runif(1)

  • b <- mu[2] + lambda[2]*stats::runif(1)

  • c <- mu[3] + lambda[3]*stats::runif(1)

Value

a list