psm_multi: A function to compute propensity score matching with multiple...

Description Usage Arguments Value Examples

View source: R/psm_multi.R

Description

With the psm_multi function you can calculate propensity score matching with multiple matches, returning a data frame with weights based in the inverse distance of a multinomial logit model.

Usage

1
  psm_multi(data, k, group, formula, var_multi)

Arguments

data

The original data frame with the multi-categorical variable and independent variables.

k

The number of nearest neighbors chosen by the user to calculate the distance between treated and untreated.

group

One category of the multi-categorical variable. The parameter group needs to be a numeric value and the categorical variable needs to be in a numerical format.

formula

Formula of the multinomial logit model.

var_multi

The position number of the multi-categorical variable in the data frame.

Value

IDENT

An identification code created to each observation.

distance

The distance between the propensity score of a treated observation and your control observation.

treatment

1 if the observation is treated in the group and 0 otherwise.

Treatment

"Treated" if the observation is treated in the group and "Untreated" otherwise.

Examples

1
2
3
4
5
6
7
8
# In this example, x1 is the multi-categorical treatment variable
# x2 and x3 are variables that determines the treatment.
# Note that x1 is the first column in the data frame, that is, var_multi = 1
# We are using two nearest neighbor, that is, k = 2.
# We are interested in the group of treatment number one, that is, group=1.
#
# dt <- data.frame(x1 =rep(c(1,2,3), 4), x2 = rnorm(12, 0, .5), x3 = rnorm(12, 1, .5))
# psm_multi(data = dt, k = 2, group = 1, formula = x1 ~ x2 + x3, var_multi = 1)

Helson-Gomes/psmMULTI documentation built on Aug. 30, 2020, 10:50 p.m.