PSmethod: Fitting propensity score models with different methods

View source: R/PSmethod.R

PSmethodR Documentation

Fitting propensity score models with different methods

Description

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.

Usage

PSmethod(
  ps.formula = ps.formula,
  method = "glm",
  data = data,
  ncate = ncate,
  ps.control = list()
)

Arguments

ps.formula

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.

method

a character to specify the method for estimating propensity scores. "glm" is default, and "gbm" and "SuperLearner" are also allowed.

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 method is set to "gbm" or "SuperLearner".

Details

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.

Value

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".

Examples

# the propensity model
ps.formula <- trt~cov1+cov2+cov3+cov4+cov5+cov6
psfit <- PSmethod(ps.formula = ps.formula,data = psdata,ncate=3)



PSweight documentation built on May 29, 2024, 3:55 a.m.