estimateTrtModel: Estimate Treatment Model for Generalized Propensity Scores

Description Usage Arguments Details Value Examples

View source: R/estimateTrtModel.R

Description

This function is used to fit the model for the generalized propensity score. Users can apply this function before multiMatch and verify that the output's fitted model object is the same as the user desires.

Usage

1
estimateTrtModel(W, X, match_on, model_options, ...)

Arguments

W

A treatment vector (1 x n) with numerical values indicating treatment groups

X

A covariate matrix (p x n) with no intercept. When match_on="existing", then X must be a vector (1 x n) of user-specified propensity scores.

match_on

User specifies "covariates" to match on raw covariates, or "existing" to match on user-supplied propensity score values, or "polr" or "multinom" to fit a propensity score model.

model_options

A list of the options to pass to propensity model. Currently under development. Can only pass reference level to multinomial logistic regression.

...

the dots argument

Details

Note that the model_options argument must be a list with reference_level element. Future versions of this package may allow for the user to supply a fitted model object directly to multiMatch; to request this feature, users should go to the GitHub repository and fill out an Issue requesting it.

Value

A list element with two items:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 sim_data <- multilevelMatching::simulated_data
 Y <- sim_data$outcome
 W <- sim_data$treatment
 X <- as.matrix(sim_data[ ,-(1:2)])
 names(Y) <- paste0("ID", 1:length(Y))

 trimming <- FALSE
 method <- c("covariates", "polr", "multinom")[2]

 prepared_data <- prepareData(
   Y = Y,
   W = W,
   X = X,
   match_on = "polr",
   trimming = FALSE,
   model_options = list(reference_level = sort(W)[1]),
   M_matches = 3,
   J_var_matches = 2
 )

trt_model <- do.call(estimateTrtModel, prepared_data)
estimated_generalized_propensity_scores <- trt_model$prop_score_ests

shuyang1987/multilevelMatching documentation built on Dec. 3, 2019, 4:04 p.m.