% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/phreg.R
\name{phreg_IPTW}
\alias{phreg_IPTW}
\title{IPTW Cox Regression (Inverse Probability of Treatment Weighted)}
\usage{
phreg_IPTW(
  formula,
  data,
  treat.model = NULL,
  treat.var = NULL,
  weights = NULL,
  estpr = 1,
  pi0 = 0.5,
  se.cluster = NULL,
  ...
)
}
\arguments{
\item{formula}{Formula for \code{phreg}.}

\item{data}{Data frame for risk averaging.}

\item{treat.model}{Propensity score model (binary or multinomial).}

\item{treat.var}{A 1/0 variable indicating when treatment is given (for time-dependent weights).}

\item{weights}{Optional weights to multiply with the IPTW weights.}

\item{estpr}{(=1, default) to estimate propensity scores and include their uncertainty in the influence function.}

\item{pi0}{Fixed simple weights (if \code{estpr=0}).}

\item{se.cluster}{To compute GEE-type standard errors when additional cluster structure is present.}

\item{...}{Arguments for \code{phreg} call.}
}
\value{
An object of class \code{"phreg"} with additional IPTW components:
\item{IID}{Influence functions including propensity score uncertainty.}
\item{iptw}{IPTW weights used.}
\item{naive.var}{Naive variance ignoring propensity score uncertainty.}
}
\description{
Fits a Cox model with treatment weights \deqn{w(A) = \sum_a I(A=a)/\pi(a|X)}, where
\deqn{\pi(a|X) = P(A=a|X)}.
}
\details{
Standard errors are computed via influence functions that are returned as the IID argument.
Propensity scores are fitted using either logistic regression (\code{glm}) or the multinomial
model (\code{mlogit}) when there are more than two treatment categories.

The treatment variable must be a factor and is identified on the RHS of the \code{treat.model}.
Recurrent events can be considered with a start-stop structure, requiring \code{cluster(id)}.
Robust standard errors are computed in all cases.

Time-dependent propensity score weights can be computed when \code{treat.var} is used. This weight
be 1 at the time of first (A_0) and 2nd treatment (A_1), then uses weights \deqn{w_0(A_0) * w_1(A_1)^{t>T_r}} where \deqn{T_r} is
time of 2nd randomization. The weights are constructed using a \code{glm} or \code{mlogit} model based on the data where 
\code{treat.var=1}. The propensity score can be constructed for any number of treatments in a similar manner.
}
\examples{
data <- mets:::simLT(0.7, 100, beta = 0.3, betac = 0, ce = 1, betao = 0.3)
dfactor(data) <- Z.f ~ Z
out <- phreg_IPTW(Surv(time, status) ~ Z.f, data = data, treat.model = Z.f ~ X)
summary(out)
}
\author{
Thomas Scheike
}
