PSmethod | R Documentation |
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,
ps.control = list()
)
ps.formula |
an object of class |
method |
a character to specify the method for estimating propensity scores. |
data |
an optional data frame containing the variables in the propensity score model. |
ncate |
a numeric to specify the number of treatment groups present in the given data. |
ps.control |
a list to specify additional options when |
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.
e.h
a data frame of estimated propensity scores.
ps.fitObjects
the fitted propensity model details
beta.h
estimated coefficient of the propensity model when method = "glm"
.
# the propensity model
ps.formula <- trt~cov1+cov2+cov3+cov4+cov5+cov6
psfit <- PSmethod(ps.formula = ps.formula,data = psdata,ncate=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.