| Type: | Package |
| Title: | Nonparametric Sobol Estimator with Bootstrap Bandwidth |
| Version: | 0.2.0 |
| Description: | Algorithm to estimate the Sobol indices using a non-parametric fit of the regression curve. The bandwidth is estimated using bootstrap to reduce the finite-sample bias. The package is based on the paper Solís, M. (2021) <doi:10.1080/03610918.2019.1655575>. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/maikol-solis/sobolnp/ |
| BugReports: | https://github.com/maikol-solis/sobolnp/issues |
| Imports: | np, parallel, pbmcapply |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| Config/roxygen2/version: | 8.1.1 |
| NeedsCompilation: | no |
| Packaged: | 2026-11-09 19:00:15 UTC; maikol |
| Author: | Maikol Solís [aut, cre] |
| Maintainer: | Maikol Solís <maikol.solis@ucr.ac.cr> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-09 19:50:02 UTC |
Plot method for objects sobolnp
Description
Bar plot of the first order Sobol indices estimated by
sobolnp, with the cross-validation and the bootstrap
bandwidth side by side for each variable.
Usage
## S3 method for class 'sobolnp'
plot(
x,
ylim = NULL,
xlab = "Variables",
ylab = "First order Sobol indices",
col = c("#0072B2", "#E69F00"),
legend.pos = "topright",
...
)
Arguments
x |
an object of class |
ylim |
limits of the y axis. By default from 0 to the larger of 1 and the largest estimated index. |
xlab, ylab |
axis labels. |
col |
colors for the cross-validation and bootstrap bars. |
legend.pos |
position of the legend, passed to
|
... |
further graphical arguments passed to
|
Value
The object x, invisibly. Called for its side effect of
drawing a plot.
Examples
ishigami.fun <- function(X) {
A <- 7
B <- 0.1
sin(X[, 1]) + A * sin(X[, 2])^2 + B * X[, 3]^4 * sin(X[, 1])
}
X <- matrix(runif(3*100, -pi, pi), ncol = 3)
Y <- ishigami.fun(X)
estimation <- sobolnp(Y = Y, X = X, nboot = 5)
plot(estimation)
Print method for objects sobolnp
Description
Print method for objects sobolnp
Usage
## S3 method for class 'sobolnp'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
Arguments
x |
an object of class |
digits |
minimal number of significant digits, see
|
... |
further arguments passed to |
Value
The object x, invisibly. Called for its side effect of
printing the estimated indices and bandwidths.
Examples
ishigami.fun <- function(X) {
A <- 7
B <- 0.1
sin(X[, 1]) + A * sin(X[, 2])^2 + B * X[, 3]^4 * sin(X[, 1])
}
X <- matrix(runif(3*100, -pi, pi), ncol = 3)
Y <- ishigami.fun(X)
estimation <- sobolnp(Y = Y, X = X, nboot = 5)
print(estimation)
Nonparametric Sobol Estimator with Bootstrap Bandwidth
Description
Algorithm to estimate the Sobol indices using a non-parametric fit of the regression curve. The bandwidth is estimated using bootstrap to reduce the finite-sample bias.
Usage
sobolnp(
Y,
X,
bandwidth = NULL,
bandwidth.compute = TRUE,
bootstrap = TRUE,
nboot = 100,
ckerorder = 2,
mc.cores = 1,
verbose = TRUE
)
Arguments
Y |
Response continuous variable |
X |
Numeric matrix or data frame of independent variables, with one
row per element of |
bandwidth |
|
bandwidth.compute |
Logical value. Indicates if the bandwidth should be estimated or not. Defaults to |
bootstrap |
Logical value. Indicates if the estimation should be with bootstrap or not. Defaults to |
nboot |
Number of bootstrap samples taken for the method. Ignored if 'bootstrap = FALSE'. Defaults to |
ckerorder |
Numeric value specifying kernel order (should be one of
|
mc.cores |
Number of cores used. Defaults to |
verbose |
Logical value. If |
Details
For each input X_i, the regression curve E[Y | X_i] is
estimated by kernel regression with a least-squares cross-validation (CV)
bandwidth, and S is the variance of the fitted curve divided by the
variance of Y.
With bootstrap = TRUE, the residuals of the CV fit are standardized
with a kernel estimate of their scale and resampled to build nboot
bootstrap responses. For a bandwidth h, the bootstrap curves give a
bias-corrected curve 2 \hat m_{CV} - \bar m^*_h and a bootstrap
index. The bootstrap bandwidth bwsboot minimizes the mean squared
distance between the bootstrap indices and S, searching between
bws / 1000 and bws, and Sboot is the mean bootstrap
index at that bandwidth.
Value
A list of class sobolnp with the following elements:
- call
The matched call.
- num.obs, num.var
Number of observations and of input variables.
- S
First order Sobol indices estimated with nonparametric regression and a cross-validation bandwidth
- bws
Bandwidth estimated with cross-validation
- Sboot
First order Sobol indices estimated with nonparametric regression and a bootstrap bandwidth
- bwsboot
Bandwidth estimated with bootstrap
Sboot and bwsboot are NULL when
bootstrap = FALSE.
References
Solís, M. (2021). Non-parametric estimation of the first-order Sobol indices with bootstrap bandwidth. Communications in Statistics - Simulation and Computation, 50(9), 2497-2512. doi:10.1080/03610918.2019.1655575
Examples
ishigami.fun <- function(X) {
A <- 7
B <- 0.1
sin(X[, 1]) + A * sin(X[, 2])^2 + B * X[, 3]^4 * sin(X[, 1])
}
X <- matrix(runif(3*100, -pi, pi), ncol = 3)
Y <- ishigami.fun(X)
estimation <- sobolnp(Y = Y, X = X, nboot = 5)