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.

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

Value

A list element with two items:

  • prop_score_model the fitted model object

  • prop_score_ests the estimated generalized propensity scores for each individual in the dataset

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.

Examples

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