bsPDP: Bootstrapped partial dependence plots

Description Usage Arguments Details Value References

View source: R/bsPDP.R

Description

Evaluates models for n_boot bootstrap iterations to obtain confidence bands for the estimated PDP.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
bsPDP(
  formula,
  variable = NULL,
  data,
  newdata = NULL,
  grid = NULL,
  outcome = NULL,
  n_boot = 100,
  p_boot = 0.6,
  N = 1000,
  method = "randomForest",
  label = NULL,
  clock = FALSE,
  test = FALSE,
  seed = 8675309,
  ...
)

Arguments

formula

(required) an output formula for the outcome.

variable

(required) the treatment variable.

data

(required) a data frame to be used for the training.

newdata

an optional data frame of test data for the PDPs (default is data).

grid

sets the values of variable to evaluate (the default is 100 values in range of variable).

n_boot

the number of bootstrap replications (default is 100).

p_boot

the proportion of the data to select for each bootstrap replication (default is 0.6).

N

the number of observations to select for calculating the PDPs (default is 1000).

method

the model method (default is 'randomForest'.

label

a character-string variable label for variable (default is variable).

clock

a logical indicating whether to time each bootstrap replication (default is FALSE.

test

a logical indicating whether to calculate the pdp for both the data and newdata (default is FALSE.

seed

a random seed (default is 8675309).

...

additional arguments specific to the method some additional arguments may be required for some methods, e.g. caret, iptw_est, and hi_est.

plot

a logical indicating whether to plot the resulting bsPDP object (default is TRUE.

Details

bsPDP currently supports the following methods:

lm for linear models

glm for generalized linear models

randomForest for random forests

caret for pramater tuning with machine-learning models (including tree ensembles and neural networks)

dbarts and BayesTree for Bayesian Additive Regression Trees (BART)

causaldrf for inverse probability-of-treatment weights estimators and the Hirano-Imbens (2004) covariate balancing estimators.

Value

bsPDP returns an object with class "bsPDP," a list that includes the following components:

variable

the treatment variable.

pdpData

the estimated average predictions and standard errors along variable.

trainData

the original training data.

testData

the test data.

outcome

the outcome class (NULL for outcomes with numeric class).

method

the method

References

Yakusheva, Olga; Bang, James T; Bobay, Kathleen; Hughes, Ronda G; Costa, Linda; and Weiss, Marianne (2021, Forthcoming). Health Services Research.

Breiman, Leo, 2001. Random forests. Machine learning. 45(1), pp.5-32.

Chipman, H.; George, E.; and McCulloch, R. (2010) BART: Bayesian Additive Regression Trees. Annals of Statistics. 4(1), pp. 266-298.

Hirano, Keisuke, Imbens, Guido W (2004). The propensity score with continuous treatments. Applied Bayesian modeling and causal inference from incomplete-data perspectives. 226164, pp. 73-84.

Schafer, J.L., Galagate, D.L. (2015). Causal inference with a continuous treatment and outcome: alternative estimators for parametric dose-response models. Doctoral dissertation.


bangecon/bsPDP documentation built on Dec. 19, 2021, 6:41 a.m.