View source: R/base_identify.R
plotshift_dens | R Documentation |
Plot a sorted estimated density function of pre- and post-stochastic-intervention values of a predictor. The closer the two functions are for pre- and post-intervention will typically mean that the stochastic intervention is better identified for a given column of the predictor matrix. This plot will generally give a useful way to visualize the implied stochastic intervention and may diagnose some issues with the intervention. This can also help diagnose issues with modeling inverse probability weights, when the estimated density is close to zero over a large portion of the data.
plotshift_dens(vibr_fit, Acol = 1, delta, ...)
vibr_fit |
a fit from varimp |
Acol |
(integer) which column of predictors in call to varimp to diagnose |
delta |
(numeric, default=0.01) change in each column of predictors in call to varimp corresponding to stochastic intervention |
... |
not used |
ggplot2 plot object
## Not run:
data(metals, package="qgcomp")
# subset of predictors
XYlist = list(X=metals[,1:4], Y=metals$y)
Y_learners = .default_continuous_learners()
Xbinary_learners = list(Lrnr_stepwise$new(name="SW"))
Xdensity_learners = .default_density_learners(n_bins=c(10))
set.seed(1231)
vi_ipw <- varimp(X=XYlist$X,Y=XYlist$Y, delta=0.1, Y_learners = Y_learners,
Xdensity_learners=Xdensity_learners[1:2], Xbinary_learners=Xbinary_learners,
estimator="TMLE")
plotshift_dens(vi_ipw, Acol=1, delta=0.01)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.