
Last chance! 50% off unlimited learning
Sale ends in
The function PSmethod
is an internal function to estimate the propensity scores given a specified model through formula.
It is built into function Sumstat
, PStrim
and PSweight
.
PSmethod(
ps.formula = ps.formula,
method = "glm",
data = data,
ncate = ncate,
...
)
an object of class formula
(or one that can be coerced to that class):
a symbolic description of the propensity score model to be fitted. Additional details of model specification
are given under "Details". This argument is optional if ps.estimate
is not NULL
.
a character to specify the method for estimating propensity scores. "glm"
is default, and "gbm"
and "SuperLearner"
are also allowed.
an optional data frame containing the variables in the propensity score model.
a numeric to specify the number of treatment groups present in the given data.
further arguments passed to or from other methods.
e.h
a data frame of estimated propensity scores.
beta.h
estimated coefficient of the propensity model when method = "glm"
.
A typical form for ps.formula
is treatment ~ terms
where treatment
is the treatment
variable and terms
is a series of terms which specifies a linear predictor. ps.formula
by default specifies generalized
linear models given the default argument method = "glm"
. It fits the logistic regression when ncate = 2
,and multinomial
logistic regression when ncate > 2
. The argument method
allows user to choose
model other than glm to fit the propensity score models. We have included gbm
and SuperLearner
as two alternative machine learning methods.
Additional arguments of the machine learning estimators can be supplied through the ...
argument. Note that SuperLearner does not handle multiple groups and the current version of multinomial
logistic regression is not supported by gbm. We suggest user to use them with extra caution. Please refer to the user manual of the gbm
and SuperLearner
packages for all the
allowed arguments.
# NOT RUN {
# the propensity model
ps.formula <- trt~cov1+cov2+cov3+cov4+cov5+cov6
psfit <- PSmethod(ps.formula = ps.formula,data = psdata,ncate=3)
# }
Run the code above in your browser using DataLab