o_beta_rsq: Betas* over a range of max R-squares

Description Usage Arguments Details Value References Examples

View source: R/robomit_functions.R

Description

Estimates betas*, i.e. the estimated bias-adjusted treatment effects, following Oster (2019) over a range of max R-squares.

Usage

1
o_beta_rsq(y, x, con, id = "none", time = "none", delta = 1, type, data)

Arguments

y

Name of the dependent variable (as string).

x

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

con

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

id

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

time

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

delta

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

type

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

data

Data.

Details

Estimates betas*, i.e. the estimated bias-adjusted treatment effects, following Oster (2019) over a range of max R-squares. The range of max R-squares starts from the R-square of the controlled model rounded up to the next 1/100 to 1. The function supports linear cross sectional (see lm objects in R) and panel fixed effect (see plm objects in R) models.

Value

Returns tibble object. Including betas* over a range of max R-squares.

References

Oster, E. (2019). Unobservable selection and coefficient stability: Theory and evidence. Journal of Business & Economic Statistics, 37, 187-204.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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 deltas* over a range of max R-squares
o_beta_rsq(y = "mpg",                 # define the dependent variable name
                x = "wt",             # define the main independent variable name
                con = "hp + qsec",    # other control variables
                delta = 1,            # define beta. This is usually set to 1
                type = "lm",          # define model type
                data = data_oster)    # define dataset

robomit documentation built on Sept. 15, 2020, 5:07 p.m.

Related to o_beta_rsq in robomit...