# Understanding the confidence interval of Sobol indices

**URL:** https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643
**Category:** Modelling & Simulations
**Tags:** question
**Created:** [November 2, 2022, 5:11am UTC](https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643 "2022-11-02T05:11:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ge0rges](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ge0rges/32/38357_2.png) [@Ge0rges](https://discourse.julialang.org/u/Ge0rges)
#### Post date: [November 2, 2022, 5:11am UTC](https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643/1 "2022-11-02T05:11:49Z")

</div>

Hello,

The documentation around the confidence level of Sobol indices is a bit sparse. Could someone explain how the following works in `GlobalSensitivity`:

- The role of `nboot`
- The role of setting `conf_level`
- How to retrieve the confidence level, and the format in which is is returned

Thank you

---

<div class="post-metadata">

### Author: ![Vaibhavdixit02](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vaibhavdixit02/32/2916_2.png) [@Vaibhavdixit02](https://discourse.julialang.org/u/Vaibhavdixit02)
#### Post date: [November 2, 2022, 4:00pm UTC](https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643/2 "2022-11-02T16:00:37Z")

</div>

[Sobol Method · GlobalSensitivity.jl](https://gsa.sciml.ai/stable/methods/sobol/) should help you for the role of the arguments.

[GlobalSensitivity.jl/sobol\_method.jl at master · SciML/GlobalSensitivity.jl · GitHub](https://github.com/SciML/GlobalSensitivity.jl/blob/master/test/sobol_method.jl#L50) shows how you can get the confidence intervals

---

<div class="post-metadata">

### Author: ![Ge0rges](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ge0rges/32/38357_2.png) [@Ge0rges](https://discourse.julialang.org/u/Ge0rges)
#### Post date: [November 2, 2022, 4:03pm UTC](https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643/3 "2022-11-02T16:03:52Z")

</div>

> [@Vaibhavdixit02](#):
>
> Sobol Method · GlobalSensitivity.jl

This doesn’t mention what a bootstrap run does however. Similarly, how does changing the confidence level change anything? Will the number of samples run be changed by the program as a function of this?

Also docs suggest `nboot>0` for confidence interval calculation but if `nboot=1` then confidence interval objects are `nothing`.

The sobol\_method.jl was helpful thank you. To clarify my understanding `sobol.ST_Conf_Int` will return a matrix where each row is a confidence number and each column is a variable passed? So:

```julia
                           variable 1 variable 2
lower conf level
upper conf level

```

---

<div class="post-metadata">

### Author: ![Vaibhavdixit02](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vaibhavdixit02/32/2916_2.png) [@Vaibhavdixit02](https://discourse.julialang.org/u/Vaibhavdixit02)
#### Post date: [November 3, 2022, 5:56pm UTC](https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643/4 "2022-11-03T17:56:15Z")

</div>

Bootstrap is [Bootstrapping (statistics) - Wikipedia](https://en.wikipedia.org/wiki/Bootstrapping_(statistics))

> Similarly, how does changing the confidence level change anything

That changes only the level (pretty well explained in [Confidence interval - Wikipedia](https://en.wikipedia.org/wiki/Confidence_interval) just in case you are not familiar) and not the number of samples, `nboot` changes the number of samples

> . To clarify my understanding `sobol.ST_Conf_Int` will return a matrix where each row is a confidence number and each column is a variable passed

EDIT: Sorry I misread this before.

No, the way the results are reported for first and total order indices’ CI is

```
 param1 param2 param3 .. ... ...

```

u1  
u2

with each cell being the error for that parameter (the columns)'s sensitivity index for the observed variable (row). So that’s why you have a 4\*12 matrix for 4 observed variables and 12 parameters. To get the CIs for the indices you’d do S1[I,j] - S1\_Conf\_Int[I,j] and S1[I,j] + S1\_Conf\_Int[I,j] (or through broadcasting)

---

<div class="post-metadata">

### Author: ![Ge0rges](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ge0rges/32/38357_2.png) [@Ge0rges](https://discourse.julialang.org/u/Ge0rges)
#### Post date: [November 6, 2022, 2:15am UTC](https://discourse.julialang.org/t/understanding-the-confidence-interval-of-sobol-indices/89643/5 "2022-11-06T02:15:20Z")

</div>

@Vaibhavdixit02 why does the confidence interval matrix have four rows for each variable? `nboot=5`

```julia
sobol_result.ST_Conf_Int = [
0.002140303660231213 0.001374899485938175 0.0007512253392035508 0.0 0.0 0.0 0.0 0.0 0.0 0.0019364005560527171 0.0015194976539914867 0.0; 
3.987682697901888e-7 0.020335209666973064 0.03977866519800592 0.0 0.0 0.0 0.0 0.0 0.0 1.610099093745705e-5 6.116174091283797e-7 0.0; 
0.0012173805419186411 0.0015130579222676734 0.004489237720529398 0.0 0.0 0.0 0.0 0.0 0.0 0.00015165970084130953 0.001567894681151645 0.0; 
0.0020468867516150084 2.2522540774355426e-5 0.003862861549576147 0.0 0.0 0.0 0.0 0.0 0.0 0.0007652690162809823 0.003977774483835621 0.0]

sobol_result.S1_Conf_Int = [
0.0021595131379424856 0.000518177371997443 0.00010912421052301298 0.0 0.0 0.0 0.0 0.0 0.0 0.001138612347448014 0.0002745154899587079 0.0; 
1.2733062154870762e-17 0.04511870593914688 1.8830925047775132e-17 0.0 0.0 0.0 0.0 0.0 0.0 3.319205919341837e-22 1.6983075940831996e-16 0.0; 
0.0002551911399908023 0.0009281213495466689 0.00013657384425105572 0.0 0.0 0.0 0.0 0.0 0.0 8.425524493092775e-5 0.004062292604195716 0.0; 
0.000757001254193339 2.152668319282848e-5 0.0004343449416748147 0.0 0.0 0.0 0.0 0.0 0.0 4.169105270114894e-8 0.004395152000136753 0.0]

```
