pscore: Propensity scores

View source: R/pscore.R

pscoreR Documentation

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 class 'pscore'
summary(object, ...)

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

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

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

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

rg(object, ...)

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

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

stdev(object, ...)

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

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

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

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

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

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

References

\insertRef

DEHE:WAHB:02micsr

\insertRef

BECK:ICHI:02micsr

Examples

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)

micsr documentation built on May 29, 2024, 7:32 a.m.