I am trying to simulate data coming from a joint model of longitudinal and survival data. Basically, my thought process is this.

  1. I need to define a maximum follow-up time, F.
  2. I need to define coefficients ($\boldsymbol{\beta}$, $\sigma_t$,generate X from some distribution, W from some distributions and define $\alpha$ and $\gamma$)
  3. I need to use the max follow-up time to solve for integrals using the uniroot function.

For each individual i, I generate survival probabilities from the uniform distribution. \begin{equation} \label{eq:uniroot1} S(t|W, X) \sim U(0,1) \end{equation}

For each individual, I am trying to solve: \begin{equation} \int_0^F h(u|\textbf{W}, m_i(u)) \partial u + \log U(0,1) = 0 \end{equation} where I define here $\textbf{W}$ are baseline covariates and $m_i(u)$ is the time-varying covariate that is essentially "longitudinal marker" without the error term defined as follows: \begin{equation} y_i(t) = m_i(t) + \epsilon_i(t) \\ m_i(t) = (\beta_0 + b_{i0}) + (\beta_1 + b_{i1})t + (\beta_2 X_{2i}) + \beta_3X_{2i}t \\ \end{equation}

And the form of the Weibull PH is as follows:

\begin{equation} \label{eq:weibullPH} (\sigma_t \exp(\alpha m_i(t) +\boldsymbol{\gamma}^T\textbf{W}_i))t^{\sigma_t-1}\\ \end{equation}

Once I solve this equation, I can just generate C from Uniform(0, Max.FollowUpTime)to perform uniform censoring.

My questions are:

A. Does this seem like the right way to get survival times?

B. How do I define the maximum follow-up time such that it is a reasonable upper bound survival time for the values I defined in point 2.

Thank you for any pointers!


1 Answer 1


Question A. Although I haven't compared every detail, it looks like your approach is the same as that used by the R simsurv package. See the vignette on the technical background to the package, and the section of a vignette dealing specifically with joint modeling. I don't know that you need to define a maximum follow-up time, but that's certainly allowed for. My sense is that the numerical methods used by the package avoids some of the problems with evaluating the cumulative hazard out to long times, but I don't have experience with that.

Question B. I think that the choice of maximum follow-up time will based on either (1) your understanding of the underlying subject matter related to a maximum time likely to be found in practice, or (2) trial and error on a data set that covers the ranges of predictors and coefficients that you have in mind.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.