% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/recreg.R
\name{sim_GLcox}
\alias{sim_GLcox}
\title{Simulation of Two-Stage Recurrent Events Data}
\usage{
sim_GLcox(
  n,
  base1,
  drcumhaz,
  var.z = 0,
  r1 = NULL,
  rd = NULL,
  rc = NULL,
  fz = NULL,
  fdz = NULL,
  model = c("twostage", "frailty", "shared"),
  type = NULL,
  share = 1,
  cens = NULL,
  nmin = 100,
  nmax = 1000
)
}
\arguments{
\item{n}{Number of IDs.}

\item{base1}{Baseline cumulative hazard for recurrent events.}

\item{drcumhaz}{Baseline cumulative hazard for the terminal event.}

\item{var.z}{Variance of the gamma frailty.}

\item{r1}{Relative risk term for the recurrent event baseline.}

\item{rd}{Relative risk term for the terminal event.}

\item{rc}{Relative risk term for censoring.}

\item{fz}{Function for transformation of the frailty term.}

\item{fdz}{Function for transformation of the frailty term for death.}

\item{model}{Model type: \code{"twostage"}, \code{"frailty"}, or \code{"shared"}.}

\item{type}{Type of simulation (default depends on \code{model}).}

\item{share}{Proportion of shared random effects (for partially shared models).}

\item{cens}{Censoring rate for exponential censoring.}

\item{nmin}{Minimum number of points in the time grid (default 100).}

\item{nmax}{Maximum number of points in the time grid (default 1000).}
}
\value{
A data frame with simulated recurrent events and terminal events, including frailty terms.
}
\description{
Simulates data based on Cox/Cox or Cox/Ghosh-Lin structures for recurrent events with a terminal event.
}
\details{
\itemize{
\item \code{type=3}: Generates data from a Cox/Cox two-stage model.
\item \code{type=2}: Generates data from a Ghosh-Lin/Cox model.
}

If \code{var.z=0}, data is generated without dependence or frailty.
If \code{model="twostage"}, the default is to generate data from a Ghosh-Lin/Cox model.
If \code{type=3}, data is generated with marginal Cox models (Cox/Cox).

Simulation is based on a linear approximation of the hazard for two-stage models on a time grid.
The grid must be sufficiently fine.
}
\references{
Scheike (2025), Two-stage recurrent events random effects models, LIDA, to appear.
}
\author{
Thomas Scheike
}
