simJM()
is a wrapper specifying
all predictors and the resulting data sets. The wrapper calls rJM()
to sample
the survival times, a modified version of rSurvtime()
from the R package
CoxFlexBoost.simJM(nsub = 300, times = seq(0, 120, 1), probmiss = 0.75,
long_setting = "functional", alpha_setting = "nonlinear",
dalpha_setting = "zero", sigma = 0.3, long_df = 6,
tmax = NULL, seed = NULL, full = FALSE, file = NULL)
rJM(hazard, censoring, x, r,
subdivisions=1000, tmin=0, tmax, file=NULL, ...)
"linear"
, "nonlinear"
and "functional"
. See Details."simple"
, "linear"
, "nonlinear"
and
"nonlinear2"
. See Details.simJM()
, longest possible survival time, observations are censored
after that timepoint. Defaults to max(times)
and should not be specified longer than
max(times)
for longitudinal setting "functional". For function rJM()
, latest
time point to sample a survival time.FALSE
)
or additionally also the data for the survival part evaluated on a regular time grid and the
longitudinal data set without longitudinal missings (TRUE
). hazard
or censoring
.full = TRUE
a list of the three data.frame
s is returned:
full = FALSE
only the first dataset is returned. Covariates within these datasets include a subject identifier id
, the sampled survival
times survtime
, the event indicator event
, the time points of longitudinally
"observed" measurements obstime
, the longitudinal response y
, the cumulative
hazard at the survival time cumhaz
, as well as covariates x1, x2
, random effects
r1, r2, b1, ...
, and the true predictors alpha, lambda, gamma, mu, sigma
.times
.
The full hazard is built from all joint model predictors \(\eta_{\mu}\), \(\eta_{\sigma}\),
\(\eta_{\lambda}\), \(\eta_{\gamma}\), \(\eta_{\alpha}\) as presented in
Koehler, Umlauf, and Greven (2016), see also jm_bamlss
. Survival times are sampled using the inversion
method (cf. Bender, Augustin, & Blettner, 2005). Additional censoring and missingness is
introduced. The longitudinal information is censored according to the survival information. The
user can also specify own predictors and use only rJM
to simulate survival times
accordingly. Pre-specified functions for \(\eta_{\mu}\) in long_setting
are for linear
$$\eta_{\mu i}(t) = 1.25 + r_{1i} + 0.6 \sin(x_{2i}) + (-0.01) t + 0.02 r_{2i} t$$,
for nonlinear
$$\eta_{\mu i}(t) = 0.5 + r_{1i} + 0.6 \sin(x_{2i}) + 0.1 (t+1) \exp(-0.075 t)$$
and for functional
$$\eta_{\mu i}(t) = 0.5 + r_{1i} + 0.6 \sin(x_{2i}) + 0.1 (t+1) \exp(-0.075 t) + \sum_k \beta_{ki} B(t)$$,
where \(B(.)\) denotes a B-spline basis function and \(\beta_{ki}\) are the sampled penalized
coefficients from gen_b
per person. Prespecified functions for \(\eta_{\alpha}\) in alpha_setting
are for constant
$$\eta_{\alpha}(t) = 1$$, for linear
$$\eta_{\alpha}(t) = 1 - 0.015 t$$, for
nonlinear
$$\eta_{\alpha}(t) = \cos((time-20)/20)$$, and for nonlinear
$$\eta_{\alpha}(t) = \cos((time-33)/33)$$. Additionally the fixed functions for \(\eta_{\lambda} = 0.1(t+2)\exp(-0.075t)\) and
\(\eta_{\lambda} = 0.1(t+2)\exp(-0.075t)\) are employed.jm_bamlss
, jm.mode
, jm.mcmc
, bamlss
.## Not run: ------------------------------------
# ## Simulate survival data
# ## with functional random intercepts and a nonlinear effect
# ## of time, time-varying association alpha.
# library("splines")
# d <- simJM(nsub = 300)
# head(d)
#
# ## Simulate survival data
# ## with random intercepts/slopes and a linear effect of time,
# ## constant association alpha.
# d <- simJM(nsub = 200, long_setting = "linear",
# alpha_setting = "constant")
# head(d)
## ---------------------------------------------
Run the code above in your browser using DataCamp Workspace