partial.dependence.plot {BoomSpikeSlab}R Documentation

Plot a Bayesian Neural Network

Description

Plot the relationship between Y and a single X variable, averaging over the values of the other X's.

Usage

  PartialDependencePlot(model,
                        which.variable,
                        burn = SuggestBurn(model),
                        data.fraction = .2,
                        gridsize = 50,
                        mean.only = FALSE,
                        show.points = TRUE,
                        xlab = NULL,
                        ylab = NULL,
                        ylim = NULL,
                        report.time = FALSE,
                        ...) 

Arguments

model

An object of class BayesNnet.

which.variable

Either an integer denoting the position of the X variable in the data frame used to fit the model, or a character string naming that variable.

burn

The number of MCMC iterations to discard as burn-in.

data.fraction

The fraction of observations in the predictor matrix to use when constructing the partial dependence plot. A random sub-sample of this fraction will be taken (without replacement) for the purposes of marginalizing over the remaining predictors.

gridsize

The number of grid points to use on the X axis.

mean.only

Logical. If TRUE then only the mean is plotted at each point. If FALSE then the posterior of the function value is plotted.

show.points

If TRUE then the scatterplot of x vs y is added to the graph. Otherwise the points are left off. Note that the estimated function might not match the pattern in the scatterplot, because the points in the scatterplot are not adjusted for the values of the other X variables.

xlab

Label for the X axis. NULL produces a default label. Use "" for no label.

ylab

Label for the Y axis. NULL produces a default label. Use "" for no label.

ylim

Limits on the vertical axis. If NULL then the plot will default to its natural vertical limits.

report.time

Print the time required to produce the plot.

...

Extra arguments are passed either to 'plot' (if mean.only is TRUE)' or 'PlotDynamicDistribution' (otherwise).

Details

A partial dependence plot shows the relationship between Y and a single X variable, averaging over the values of the other X's in a possibly nonlinear regression model. Partial dependence plots are a generalization of the "added variable plot" idea from linear regression models.

A partial dependence plot is more expensive to produce than most other plots, because a set of predictions must be generated at each point on the X axis. This is done by taking a random subset of the training data, and evaluating the posterior predictive distribution with each observation's target X value set to each value of X on the grid.

Author(s)

Steven L. Scott

See Also

plot.BayesNnet

Examples

  # Please see the code in ?BayesNnet

[Package BoomSpikeSlab version 1.2.4 Index]