sobol: BASS Sensitivity Analysis

View source: R/sobol_normTmix.R

sobolR Documentation

BASS Sensitivity Analysis

Description

Decomposes the variance of the BASS model into variance due to main effects, two way interactions, and so on, similar to the ANOVA decomposition for linear models. Uses the Sobol' decomposition, which can be done analytically for MARS models.

Usage

sobol(
  bassMod,
  prior = NULL,
  prior.func = NULL,
  mcmc.use = NULL,
  func.var = NULL,
  xx.func.var = NULL,
  verbose = TRUE,
  getEffects = FALSE
)

Arguments

bassMod

a fitted model output from the bass function.

prior

a list of priors; uniform, truncated mixture of Normals or Ts for continuous; vector of category weights for categorical. Default is uniform over range of data.

prior.func

prior for functional variable. In almost all cases, keep this as the uniform default.

mcmc.use

an integer vector indexing which MCMC iterations to use for sensitivity analysis.

func.var

an integer indicating which functional variable to make sensitivity indices a function of. Disregard if bassMod is non-functional or if scalar sensitivity indices are desired.

xx.func.var

grid for functional variable specified by func.var. Disregard if func.var is not specified. If func.var is specified and xx.func.var not specified, the grid used to fit bass will be used.

verbose

logical; should progress be displayed?

getEffects

logical; should Sobols ANOVA decomposition be computed?

Details

Performs analytical Sobol' decomposition for each MCMC iteration in mcmc.use (each corresponds to a MARS model), yeilding a posterior distribution of sensitivity indices. Can obtain Sobol' indices as a function of one functional variable.

Value

If non-functional (func.var = NULL), a list with two elements:

S

a data frame of sensitivity indices with number of rows matching the length of mcmc.use. The columns are named with a particular main effect or interaction. The values are the proportion of variance in the model that is due to each main effect or interaction.

T

a data frame of total sensitivity indices with number of rows matching the length of mcmc.use. The columns are named with a particular variable.

Otherwise, a list with four elements:

S

an array with first dimension corresponding to MCMC samples (same length as mcmc.use), second dimension corresponding to different main effects and interactions (labeled in names.ind), and third dimension corresponding to the grid used for the functional variable. The elements of the array are sensitivity indices.

S.var

same as S, but scaled in terms of total variance rather than percent of variance.

names.ind

a vector of names of the main effects and interactions used.

xx

the grid used for the functional variable.

See Also

bass for model fitting and predict.bass for prediction.

Examples

# See examples in bass documentation.


BASS documentation built on July 9, 2023, 6:57 p.m.

Related to sobol in BASS...