Learn R Programming

robomit (version 1.0.7)

o_beta: beta*

Description

Estimates beta*, i.e., the bias-adjusted treatment effect (or correlation) (following Oster 2019). The code is based on the psacalc command in Stata.

Usage

o_beta(y, x, con, w = NULL, id = "none", time = "none", delta = 1,
R2max, type, data)

Value

Returns tibble object, which includes beta* and various other information.

Arguments

y

Name of the dependent variable (as string).

x

Name of the independent treatment variable (i.e., variable of interest; as string).

con

Name of related control variables. Provided as string in the format: "w + z +...".

w

weights (only for weighted estimations). Warning: For weighted panel models R can report different R-square than Stata, leading deviation between R and Stata results.

id

Name of the individual id variable (e.g. firm or farm; as string). Only applicable for fixed effect panel models.

time

Name of the time id variable (e.g. year or month; as string). Only applicable for fixed effect panel models.

delta

delta for which beta* should be estimated (default is delta = 1).

R2max

Maximum R-square for which beta* should be estimated.

type

Model type (either lm or plm; as string).

data

Dataset.

Details

Estimates beta*, i.e., the bias-adjusted treatment effect (or correlation).

References

Oster, E. (2019) Unobservable Selection and Coefficient Stability: Theory and Evidence. Journal of Business & Economic Statistics, 37, 187-204.

Examples

Run this code
# load data, e.g. the in-build mtcars dataset
data("mtcars")
data_oster <- mtcars

# preview of data
head(data_oster)

# load robomit
require(robomit)

# estimate beta*
o_beta(y = "mpg",           # dependent variable
       x = "wt",            # independent treatment variable
       con = "hp + qsec",   # related control variables
       delta = 1,           # delta
       R2max = 0.9,         # maximum R-square
       type = "lm",         # model type
       data = data_oster)   # dataset

Run the code above in your browser using DataLab