| iptw {twang} | R Documentation |
Inverse probability of treatment weighting for marginal structural models.
Description
iptw calculates propensity scores for sequential treatments using gradient boosted logistic
regression and diagnoses the resulting propensity scores using a variety of
methods
Usage
iptw(
formula,
data,
timeInvariant = NULL,
cumulative = TRUE,
timeIndicators = NULL,
ID = NULL,
priorTreatment = TRUE,
n.trees = 10000,
interaction.depth = 3,
shrinkage = 0.01,
bag.fraction = 1,
n.minobsinnode = 10,
perm.test.iters = 0,
print.level = 2,
verbose = TRUE,
stop.method = c("es.max"),
sampw = NULL,
version = "gbm",
ks.exact = NULL,
n.keep = 1,
n.grid = 25,
...
)
Arguments
formula |
Either a single formula (long format) or a list with formulas. |
data |
The dataset, includes treatment assignment as well as covariates. |
timeInvariant |
An optional formula (with no left-hand variable) specifying time-invariant chararacteristics. |
cumulative |
If |
timeIndicators |
For long format fits, a vector of times for each observation. |
ID |
For long format fits, a vector of numeric identifiers for unique analytic units. |
priorTreatment |
For long format fits, includes treatment levels from previous times if |
n.trees |
Number of gbm iterations passed on to |
interaction.depth |
A positive integer denoting the tree depth used in gradient boosting. Default: 3. |
shrinkage |
A numeric value between 0 and 1 denoting the learning rate.
See |
bag.fraction |
A numeric value between 0 and 1 denoting the fraction of
the observations randomly selected in each iteration of the gradient
boosting algorithm to propose the next tree. See |
n.minobsinnode |
An integer specifying the minimum number of observations
in the terminal nodes of the trees used in the gradient boosting. See |
perm.test.iters |
A non-negative integer giving the number of iterations
of the permutation test for the KS statistic. If |
print.level |
The amount of detail to print to the screen. Default: 2. |
verbose |
If |
stop.method |
A method or methods of measuring and summarizing balance across pretreatment
variables. Current options are |
sampw |
Optional sampling weights. |
version |
Default: |
ks.exact |
|
n.keep |
A numeric variable indicating the algorithm should only
consider every |
n.grid |
A numeric variable that sets the grid size for an initial
search of the region most likely to minimize the |
... |
Additional arguments that are passed to ps function. |
Details
For user more comfortable with the options of
xgboost::xgboost(),
the options for iptw controlling the behavior of the gradient boosting
algorithm can be specified using the xgboost naming
scheme. This includes nrounds, max_depth, eta, and
subsample. In addition, the list of parameters passed to
xgboost can be specified with params.
Value
Returns an object of class iptw, a list containing
psListA list of
psobjects with length equal to the number of time periods.estimandThe specified estimand.
stop.methodsThe stopping rules used to optimize
iptwbalance.nFitsThe number of
psobjects (i.e., the number of distinct time points).uniqueTimesThe unique times in the specified model.
See Also
ps, mnps, gbm, xgboost, plot, bal.table