Learn R Programming

micsr (version 0.1-1)

pscore: Propensity scores

Description

Propensity scores estimation, using an algorithm that checks the balancing hypothesis using strata and enable the estimation of the treatment effect using stratification methods

Usage

pscore(formula, data, maxiter = 4, tol = 0.005, link = c("logit", "probit"))

# S3 method for pscore summary(object, ...)

# S3 method for pscore print( x, ..., digits = getOption("digits"), var_equal = c("none", "strata", "group", "both") )

# S3 method for summary.pscore print( x, ..., digits = getOption("digits"), format = c("rst", "pipe", "simple"), step = c("all", "strata", "covariates", "atet") )

# S3 method for pscore nobs(object, ..., smpl = c("total", "cs"))

# S3 method for summary.pscore nobs(object, ..., smpl = c("total", "cs"))

rg(object, ...)

# S3 method for pscore rg(object, ..., smpl = c("total", "cs"))

# S3 method for summary.pscore rg(object, ..., smpl = c("total", "cs"))

stdev(object, ...)

# S3 method for pscore mean(x, ..., var_equal = c("none", "strat", "group", "both"))

# S3 method for summary.pscore mean(x, ...)

# S3 method for pscore stdev(object, ..., var_equal = c("none", "strata", "group", "both"))

# S3 method for summary.pscore stdev(object, ..., var_equal = c("none", "strata", "group", "both"))

Value

an object of class "pscore", with the following elements:

  • strata: a tibble containing the stratas, the frequencies, the means and the variances of the propensity scores for treated and controled observations

  • cov_balance: a tibble containing the results of the balancing tests for every covariate; the results for the class with the lowest p-value is reported

  • unchecked_cov: a character vector containing the names of the covariates for which the balancing test could be computed

  • model: a tibble containing the original data, with supplementary columns: gp_ for the groups, resp_ for the outcome and cls_ for the stratas

  • pscore: the glm model fitted to compute the propensity scores

Arguments

formula

a Formula object; the left-hand side should contain two variables (x1 + x2), where x1 is the group variable and x2 the outcome. The group variable can be either a dummy for treated individuals or a factor with levels "treated" and "control"

data

a data frame

maxiter

the maximum number of iterations

tol

stratas are cut in halves as long as the hypothesis of equal means is rejected at the tol level,

link

the link for the binomial glm estimation, either "logit" or "probit"

...

further arguments

x, object

a "pscore" or a "summary.pscore" object

digits

number of digits for the print methods

var_equal

to compute the variance of the ATET, variances can be computed at the class/group level (var_equal = "none"), at the class level (var_equal = "group"), at the group level (var_equal = "strata") or globally (var_equal = "both")

format

one of "rst" "pipe" and "simple", this argument is passed to knitr::kable

step

for the print.summary method, the step of the test to be printed: one of "all" (the default), strata, covariates and atet

smpl

the sample to use, either the whole sample (smpl = "total") or the sample with common support (smpl = "cs")

References

DEHE:WAHB:02micsr

BECK:ICHI:02micsr

Examples

Run this code
data_tuscany <- dplyr::mutate(dplyr::filter(twa, region == "Tuscany"),
  dist2 = dist ^ 2, livselfemp = I((city == "livorno") * (occup == "selfemp")),
  perm = ifelse(outcome == "perm", 1, 0))
formula_tuscany <- group | perm ~ city + sex + marital + age +
   loc + children + educ + pvoto + training +
   empstat + occup + sector + wage + hour + feduc + femp + fbluecol +
   dist + dist2 + livselfemp
pscore(formula_tuscany, data_tuscany)

Run the code above in your browser using DataLab