% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sim-pc-hazard.R
\name{sim_phregs}
\alias{sim_phregs}
\title{Simulation of Cause-Specific Cox Models}
\usage{
sim_phregs(
  coxs,
  n,
  data = NULL,
  rr = NULL,
  strata = NULL,
  entry = NULL,
  extend = TRUE,
  cens = NULL,
  rrc = NULL,
  ...
)
}
\arguments{
\item{coxs}{List of Cox models.}

\item{n}{Number of simulations.}

\item{data}{Data frame to extract covariates.}

\item{rr}{Relative risks.}

\item{strata}{Strata vector.}

\item{entry}{Delayed entry.}

\item{extend}{Extend baselines to largest endpoint.}

\item{cens}{Censoring specification.}

\item{rrc}{Relative risks for censoring.}

\item{...}{Arguments for \code{rchaz}.}
}
\value{
Data frame with simulated event times, status, and covariates.
}
\description{
Simulates data that looks like fit from cause-specific Cox models. Censors data 
automatically. When censoring is given in the list of causes, this provides censoring 
that looks like the data.
}
\examples{
data(bmt)
nsim <- 100; 

cox1 <- phreg(Surv(time,cause==1)~strata(tcell)+platelet+age,data=bmt)
cox2 <- phreg(Surv(time,cause==2)~tcell+strata(platelet),data=bmt)
coxs <- list(cox1,cox2)
## just calls sim_phregs !
dd <- sim_phregs(coxs,nsim,data=bmt,extend=c(0.001))
scox1 <- phreg(Surv(time,cause==1)~strata(tcell)+platelet+age,data=dd)
scox2 <- phreg(Surv(time,cause==2)~tcell+strata(platelet),data=dd)

cbind(cox1$coef,scox1$coef)
cbind(cox2$coef,scox2$coef)
par(mfrow=c(1,2))
plot(cox1); plot(scox1,add=TRUE); 
plot(cox2); plot(scox2,add=TRUE); 

}
\author{
Thomas Scheike
}
\keyword{simulation}
\keyword{survival}
