plotshift_scatter: Visualizing stochastic interventions via bivariate plots

View source: R/base_identify.R

plotshift_scatterR Documentation

Visualizing stochastic interventions via bivariate plots

Description

This helps identify some potential identifiability issues that may not be picked up via weight diagnostics. A bivariate plot (where the X-axis variable is plotted with both the observed and "intervened" values). If the intervention implies predictors that are pushed outside the support of the data, this will manifest as shifted observations that are far from the observed observations. This is a low-dimensional way to roughly check identifiability of interventions, though users should be aware that identifiability is much more problematic with larger dimensions (number of predictors).

Usage

plotshift_scatter(vibr_fit, Acol, Bcol, delta = NULL, ...)

Arguments

vibr_fit

a vibr_fit object from varimp

Acol

(integer) which column of predictors in call to varimp to diagnose

Bcol

(integer) second 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

Examples

## Not run: 
data(metals, package="qgcomp")
# subset of predictors
XYlist = list(X=metals[,1:7], 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, Xbinary_learners=Xbinary_learners,
       estimator="TMLE")
plotshift_scatter(vi_ipw, Acol=1, Bcol=2, delta=0.1)
# delta = 0.1, seems reasonable in two dimensions, but may lead to
extrapolation in more dimensions. Good to check with other "Bcol" variables
plotshift_scatter(vi_ipw, Acol=1, Bcol=5, delta=0.1)
# contrast with an intervention level that leads to obvious extrapolation
plotshift_scatter(vi_ipw, Acol=1, Bcol=2, delta=1)
plotshift_scatter(vi_ipw, Acol=1, Bcol=5, delta=1)

## End(Not run)

alexpkeil1/vibr documentation built on Sept. 13, 2023, 3:20 a.m.