% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/npests.R
\name{test_quasiindep_ctau}
\alias{test_quasiindep_ctau}
\alias{print.quasiindep_ctau_test}
\title{Test for dependence between truncation times and the event time}
\usage{
test_quasiindep_ctau(y, data = NULL, singular_thresh = 1e-09)

\method{print}{quasiindep_ctau_test}(x, ...)
}
\arguments{
\item{y}{A \code{Survdt} object or expression. Observations with missing values are
discarded. See \code{\link[=Survdt]{Survdt()}}.}

\item{data}{An optional data frame used to evaluate \code{y}.}

\item{singular_thresh}{The numerical threshold for determining whether the
variance matrix for the correlations is singular (default \code{1e-9}).
This can occur when the truncation times are a constant distance from each
other.}

\item{x}{Any R object.}

\item{...}{Additional arguments passed to other methods.}
}
\value{
\code{\link[=test_quasiindep_ctau]{test_quasiindep_ctau()}} returns an object of class \code{quasiindep_ctau_test},
i.e. a list with the following components:
\item{tau}{A numerical vector of length two containing the estimated
conditional Kendall's tau rank correlation (1) between the event time and
left truncation time, and (2) between the event time and right truncation
time.}
\item{teststat}{The chi-squared test statistic for testing the null hypothesis
that both correlations are zero.}
\item{df}{The degrees of freedom for \code{teststat}.}
\item{pval}{The p-value for testing that both correlations are zero.}
\item{var_matrix}{The estimated variance matrix for the two conditional
Kendall's tau correlation estimates.}
\item{singular}{Whether \code{var_matrix} was determined to be singular.}
\item{prob_comp}{The fraction of subject pairs that are comparable.}

The \code{print} method for \code{quasiindep_ctau_test} objects displays a summary of
the test results.
}
\description{
Computes the conditional Kendall's tau rank correlation between the event
time and each of the two truncation times, accounting for double truncation.
Then tests whether both correlations are equal to zero.

Typically used to determine if nonparametric analysis can be done using the
NPMLE, which requires quasi-independence (see \code{\link[=npmle]{npmle()}}).
}
\details{
The conditional Kendall's tau rank correlation between the left truncation
time and event time is estimated by the average of
\deqn{\text{sign}\{(T_i - T_j)(L_i - L_j)\}}
across all comparable pairs of subjects \eqn{(i,j)}.
A pair is called comparable if \eqn{L_j<T_i \leq R_j} and \eqn{L_i<T_j \leq R_i},
which ensures that the order of the pair's times is not influenced by truncation
under quasi-independence.
Similarly, the conditional Kendall's tau rank correlation between the right
truncation time and event time is estimated by the average of
\deqn{\text{sign}\{(T_i - T_j)(R_i - R_j)\}}
across the same comparable pairs of subjects \eqn{(i,j)}.

Under quasi-independent truncation, both conditional Kendall's tau rank
correlations should converge to zero in large samples.
}
\examples{
test_quasiindep_ctau(Survdt(incu, ltrunc, rtrunc), aids)

}
\references{
Martin, E. C., & Betensky, R. A. (2005). Testing quasi-independence of failure
and truncation times via conditional Kendall's tau. \emph{Journal of the American
Statistical Association}, \strong{100}(470), 484--492.
}
\seealso{
\itemize{
\item \code{\link[=test_quasiindep_covariates]{test_quasiindep_covariates()}}: a test for dependent truncation when
covariates are involved, e.g. when aiming to analyze data with
\code{\link[=coxph_indtrunc]{coxph_indtrunc()}}.
}
}
