Description Usage Arguments Details Value Examples
'gob' implements the Generalized Oaxaca-Blinder covariate adjustment of Guo and Basse (2020). The function currently supports linear models and generalized linear models out of the box; it allows allows the specification of custom regression functions.
1 |
form |
A formula or a call-formula (see details for 'call-formula'). |
Z |
A vector of assignments. |
pred.fn.ls |
A list of learners for the treatment and control potential outcomes (see details). |
data |
(optional) A dataframe whose columns include all the variables referenced in 'form'. If 'NULL', the variables in 'form' will be taken from the calling environment. |
alpha |
The confidence level (defaults to 0.95). |
Adjustment via linear and generalized linear models is as easy as:
> gob(lm(Y ~ X1 + X2), Z)
or
> gob(glm(Y ~ X1 + X2, family=gaussian), Z)
for linear adjustment. Nonlinear adjustment via the 'glm' function is also straightforward, e.g.
> gob(glm(Y ~ X1 + X2, family=Poisson), Z)
A list whose first element is a point estimate, and second element is a confidence interval.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(RGOB)
N <- 100
X <- rnorm(N); B <- rnorm(N); C <- rnorm(N)
Z <- sample(c(0,1), N, replace=TRUE)
Y <- 1 + 0.2 * X + 0.5 * Z + rnorm(N, sd=0.1)
Yb <- ifelse(Y > 1.2, 1, 0)
dat <- data.frame(Yp=Y, D=X, E=B, F=C, Ybp=Yb)
# Using lm for covariate adjustment
gob(lm(Y ~ X + B), Z)
gob(lm(Yp~ D + E), Z, data=dat)
# Using logistic regression adjustment
gob(glm(Yb ~ X + B, family=binomial(link="logit")), Z)
gob(glm(Ybp ~ D + E, family=binomial(link="logit")), Z, data=dat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.