View source: R/base_identify.R
dx_dens | R Documentation |
Give a numerical (but cruder) version of the diagnostics in plotshift_dens, where one can track the change in estimated exposure mass/density following a stochastic intervention on exposure.
dx_dens(vibr_fit, Acol = 1, delta = 0.01, quantiles = c(0, 0.1, 0.9, 1))
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 |
quantiles |
(numeric vector, default=c(0, 0.1, 0.9, 1)) cutpoints in the closed interval [0,1] that correspond to quantiles of the estimated density of observed values of a predictor. The length of this vector determines the size of the table. Using values close to 0 or 1 allows one to track whether "intervened" predictors are pushed toward the extreme of the estimated predictor density, which could indicate lack of support for the scale of the implied intervention (e.g. delta is too big). |
## 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="IPW")
dx_dens(vi_ipw, Acol=1, delta=0.01)
# this shows that most observations keep a similar density range
dx_dens(vi_ipw, Acol=1, delta=0.01, quantiles=c(0, 0.1, 0.3, 0.7, 0.9, 1))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.