Description Usage Arguments Details Value References Examples
View source: R/robomit_functions.R
Estimates and visualizes deltas*, i.e. the degree of selection on unobservables relative to observables that would be necessary to explain away the result, following Oster (2019) over a range of max R-squares.
1 | o_delta_rsq_viz(y, x, con, id = "none", time = "none", beta = 0, type, data)
|
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. |
beta |
Beta for which delta* should be estimated (default is beta = 0). |
type |
Model type (either lm or plm; as string). |
data |
Data. |
Estimates and visualizes deltas*, i.e. the degree of selection on unobservables relative to observables that would be necessary to explain away the result, 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.
Returns ggplot object. Including deltas* over a range of max R-squares.
Oster, E. (2019). Unobservable selection and coefficient stability: Theory and evidence. Journal of Business & Economic Statistics, 37, 187-204.
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 and visualize deltas* over a range of max R-squares
o_delta_rsq_viz(y = "mpg", # define the dependent variable name
x = "wt", # define the main independent variable name
con = "hp + qsec", # other control variables
beta = 0, # define beta. This is usually set to 0
type = "lm", # define model type
data = data_oster) # define dataset
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.