Description Usage Arguments Examples
Illustrates how the intervention changes the distribution of X by plotting barchart (for categorical variables) or denisty plot (for continouous variables), before and after the intervention.
1 2 | plot_change(x, plot.vars = "sig", graph.col = c("red", "blue"),
alpha = 0.05, line.type = c(1, 2), n.val = 10)
|
x |
an optint object. |
plot.vars |
which variables to plot? either a number (n) - indicating to plot the first n variables, "sig" (default) - plot only significant variables, or a vector with names of variables to plot. |
graph.col |
graph color/s. |
alpha |
significance level for the confidence intervals. also used in order to determine which variables are significant. |
line.type |
line type for |
n.val |
variable with more values than 'n.val' will be displayed by density plot, while variable with fewer values will be displayed by barchart. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # generate data
n <- 50
p <- 3
features <- matrix(rnorm(n*p), ncol = p)
men <- matrix(rbinom(n, 1, 0.5), nrow = n)
outcome <- 2*(features[,1] > 1) + men*pmax(features[,2], 0) + rnorm(n)
outcome <- as.vector(outcome)
#find the optimal intervention using the non-parametric method:
imp_feat <- optint(Y = outcome, X = features, control = men,
method = "non-parametric", lambda = 10, plot = TRUE,
n.boot = 100, n.perm = 100)
#we can look on the new features distribution more deeply, using plot_change():
plot_change(imp_feat, plot.vars = "sig")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.