% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ipwCoxInd.R
\name{ipwCoxInd}
\alias{ipwCoxInd}
\title{Corrected sandwich inference for the marginal HR in the IPW Cox model for the standard setting of independent data}
\usage{
ipwCoxInd(
  data,
  indA,
  indX,
  indStatus,
  indTime,
  weightType = "ATE",
  ties = "breslow",
  confidence = 0.95
)
}
\arguments{
\item{data}{A data set to be analyzed in the form of R data frame.}

\item{indA}{A column name indicating the treatment variable (1 = treated, 0 = untreated).}

\item{indX}{A vector of column names specifying the covariates to be included in the propensity score model. Any covariate with the same value across all observations will be excluded, as it does not contribute to propensity score estimation.}

\item{indStatus}{A column name indicating the non-censoring status (1 = event, 0 = censored).}

\item{indTime}{A column name indicating the outcome variable, i.e., min(true event time, censoring time).}

\item{weightType}{A character string specifying the type of weight ("ATE" when the estimand is the average treatment effect, or "ATT" when the estimand is the average treatment effect in the treated); the default is "ATE".}

\item{ties}{A character string specifying the method ("efron","breslow", or "exact") used to handle tied event times for point estimation; the default is "breslow". For variance estimation, the Breslow method is used to handle tied event times.}

\item{confidence}{A confidence level between 0 and 1; the default is 0.95 corresponding to a 95 per cent confidence interval.}
}
\value{
A matrix of inference results from the inverse probability weighted Cox model for independent data. The columns report the estimated log hazard ratio, the corrected sandwich standard error of the log hazard ratio, the estimated hazard ratio, the confidence interval for the hazard ratio computed using the corrected sandwich variance, and the p-value, respectively. Each row corresponds to a weight type.
}
\description{
Inference for the marginal hazard ratio (HR) in the inverse probability weighted (IPW) Cox model for the standard setting, assuming independence among observations (rows). Corrected sandwich variance (CSV) estimation method is used to estimate the variance of the estimated log HR and to construct confidence intervals for the HR.
}
\examples{
#simulate a data set with a marginal hazard ratio of 1.5
set.seed(100)
n=700
T0=rexp(n, rate=0.01)
ZZZ=rnorm(n)
X1= 0.5*(T0+0.2)/(T0+1)+0.3*ZZZ
X2= 1/log(1.3*T0+3)-0.3*ZZZ
X3= rbinom(n,1,0.3+0.5/(T0+1))  
A=rbinom(n,1,1/(1+exp(0.53+X1-X2-X3)))
Ttime <- T0*exp(-log(1.5)*A)
rateC=0.0005
C <- rexp(n, rate=rateC)
time <- pmin(Ttime, C)
status <- as.numeric(Ttime <= C)
da=data.frame(id=1:n,time=time,status=status,A=A,X1=X1,X2=X2,X3=X3)
head(da)
#corrected sandwich variance-based inference results for the marginal hazard ratio 
ipwCoxInd(data=da,indA="A",indX=c("X1","X2","X3"),indStatus="status",indTime="time")

}
