o_delta_rsq: delta*s over a range of maximum R-squares

Description Usage Arguments Details Value References Examples

View source: R/robomit_functions.R

Description

Estimates delta*s, i.e., the degree of selection on unobservables relative to observables (with respect to the treatment variable) that would be necessary to eliminate the result (following Oster 2019) over a range of maximum R-squares following Oster (2019).

Usage

1
2
o_delta_rsq(y, x, con, m = "none", w = NULL, id = "none", time = "none", beta = 0,
type, data)

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 +...".

m

Name of unrelated control variables (m; see Oster 2019; as string; default is m = "none").

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.

beta

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

type

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

data

Dataset.

Details

Estimates delta*s, i.e., the degree of selection on unobservables relative to observables (with respect to the treatment variable) that would be necessary to eliminate the result (following Oster 2019) over a range of maximum R-squares. The range of maximum 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 fixed effect panel (see plm objects in R) models.

Value

Returns tibble object, which includes delta*s over a range of maximum 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 delta*s over a range of maximum R-squares
o_delta_rsq(y = "mpg",           # dependent variable
            x = "wt",            # independent treatment variable
            con = "hp + qsec",   # related control variables
            beta = 0,            # beta
            type = "lm",         # model type
            data = data_oster)   # dataset

robomit documentation built on June 22, 2021, 9:09 a.m.

Related to o_delta_rsq in robomit...