% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CorrelatedPfsAndOs2.R
\name{CorrelatedPfsAndOs2}
\alias{CorrelatedPfsAndOs2}
\title{Generate Correlated PFS and OS Using Gumbel Copula}
\usage{
CorrelatedPfsAndOs2(
  n,
  median_pfs,
  median_os,
  kendall,
  pfs_name = "pfs",
  os_name = "os"
)
}
\arguments{
\item{n}{integer. Number of observations.}

\item{median_pfs}{numeric. Median of PFS.}

\item{median_os}{numeric. Median of OS.}

\item{kendall}{numeric. Kendall's tau between observed, uncensored PFS and OS.
Must be positive and usually away from zero. Note that
this argument is not the Kendall's tau between TTP and OS.}

\item{pfs_name}{column name of PFS in returned data frame. It must be
consistent with name in the function \code{endpoint()}.}

\item{os_name}{column name of OS in returned data frame. It must be
consistent with name in the function \code{endpoint()}.}
}
\value{
A data frame of \code{n} rows and four columns, including PFS, OS and their
event indicators. The event indicators are all 1s. The column names are
\code{<pfs_name>}, \code{<pfs_name>_event}, \code{<os_name>},
and \code{<os_name>_event}.
}
\description{
Generate correlated PFS and OS endpoints using the Gumbel copula. Marginally,
both PFS and OS follow exponential distributions. This function can be used
as custom \code{generator} in the function \code{endpoint()}.

Note that the Gumbel copula is applied to the survival functions of OS and
time-to-progression (TTP). PFS is defined as min(TTP, OS), which also
follows an exponential distribution.

For more information, refer to
\href{https://zhangh12.github.io/TrialSimulator/articles/simulatePfsAndOsGumbel.html}{this vignette}.
}
\examples{
pfs_and_os <- endpoint(name = c('PFS', 'Os'),
                       type = c('tte', 'tte'),
                       generator = CorrelatedPfsAndOs2,
                       median_pfs = 5,
                       median_os = 11,
                       kendall = .6,
                       pfs_name = 'PFS',
                       os_name = 'Os')

pfs_and_os # run it in console to see summary report

## for validation purpose only
## not the recommended way to use TrialSimulator
dat <- pfs_and_os$test_generator(n = 1e4)
cor(dat[, 1:2], method = 'kendall') ## close to 0.6

}
