Description Usage Arguments Details Value Author(s) Examples
Plots weight of each observation in the score condition ω(π) for propensity score estimation and estimated propensity score distribution in the navigated weighting.
1 | plot_omega(object, relative = TRUE)
|
object |
an object of class “nawt”, usually, a result of a call to |
relative |
a logical value indicating whether or not relative weights standardized to have mean one are shown. |
The x-axis shows estimated propensity scores, and the y-axis shows weight of
each observation in propensity score estimation. When estimand = "ATE"
,
the navigated weighting estimates two propensity scores for each observation;
one for estimating the average of the potential outcomes with treatment and
the other for estimating the average of the potential outcomes without
treatment. Therefore, there are two weighting functions for estimating two
sets of propensity scores and two propensity score distributions. Points
rising to the right and a solid curve represent the weighting functions and
distribution of propensity scores for estimating the average of the potential
outcomes without treatment whereas points rising to the left and a dashed
curve represent the weighting functions and distribution of propensity scores
for estimating the average of the potential outcomes with treatment.
Position of the legend is determined internally.
No retrun value, called for side effects.
Hiroto Katsumata
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Simulation from Kang and Shafer (2007) and Imai and Ratkovic (2014)
tau <- 10
set.seed(12345)
n <- 1000
X <- matrix(rnorm(n * 4, mean = 0, sd = 1), nrow = n, ncol = 4)
prop <- 1 / (1 + exp(X[, 1] - 0.5 * X[, 2] + 0.25 * X[, 3] + 0.1 * X[, 4]))
treat <- rbinom(n, 1, prop)
y <- 210 + 27.4 * X[, 1] + 13.7 * X[, 2] + 13.7 * X[, 3] + 13.7 * X[, 4] +
tau * treat + rnorm(n)
# Data frame and formulas for propensity score estimation
df <- data.frame(X, treat, y)
colnames(df) <- c("x1", "x2", "x3", "x4", "treat", "y")
formula_c <- as.formula(treat ~ x1 + x2 + x3 + x4)
# Power weighting function with alpha = 2
# ATT estimation
fitatt <- nawt(formula = formula_c, outcome = "y", estimand = "ATT",
method = "score", data = df, alpha = 2)
plot_omega(fitatt)
# ATE estimation
fitate <- nawt(formula = formula_c, outcome = "y", estimand = "ATE",
method = "score", data = df, alpha = 2)
plot_omega(fitate)
# Use method = "both"
# Two-step estimation
fitateb2s <- nawt(formula = formula_c, outcome = "y", estimand = "ATE",
method = "both", data = df, alpha = 2, twostep = TRUE)
plot_omega(fitateb2s)
# Continuously-updating GMM estimation
## Not run:
fitatebco <- nawt(formula = formula_c, outcome = "y", estimand = "ATE",
method = "both", data = df, alpha = 2, twostep = FALSE)
plot_omega(fitatebco) # error
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.