# Is there a way to check Sobol parameters Confidence interval (CI)?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692>\
**Category:** Numerics\
**Tags:** diffeq\
**Created:** [July 23, 2019, 4:52pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692 "2019-07-23T16:52:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alewolf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alewolf/32/9000_2.png) [@alewolf](https://discourse.julialang.org/u/alewolf)\
**Post date:** [July 23, 2019, 4:52pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/1 "2019-07-23T16:52:24Z")

</div>

Hi,

Running sobol\_sensitivity in DiffEqSensitivity gives some negative values - even while useing the equation ind documents.

```julia
function f(du,u,p,t)
  du[1] = p[1]*u[1] - p[2]*u[1]*u[2]
  du[2] = -3*u[2] + u[1]*u[2]
end
u0 = [1.0;1.0]
tspan = (0.0,10.0)
p = [1.5,1.0]
prob = ODEProblem(f,u0,tspan,p)
t = collect(range(0, stop=10, length=200))

s0 = sobol_sensitivity(prob,Tsit5(),t,[[1,5],[0.5,5]],N,0)
Out[8]: 2-element Array{Array{Float64,2},1}:
 [NaN 0.507831 … 1.00731 1.00436; NaN 1.92336 … 0.732384 0.730945]
 [NaN 0.47214 … 0.676224 0.681525; NaN -1.68656 … 0.879557 0.877603]

s1 = sobol_sensitivity(prob,Tsit5(),t,[[1,5],[0.5,5]],N,1)
Out[9]: 2-element Array{Array{Float64,2},1}:
 [NaN 0.39537 … 0.341697 0.343645; NaN -2.06101 … 0.10922 0.106976]
 [NaN 0.652815 … 0.00910675 0.00815206; NaN 5.24832 … 0.296978 0.296639]

s2 = sobol_sensitivity(prob,Tsit5(),t,[[1,5],[0.5,5]],N,2)
Out[10]: 1-element Array{Array{Float64,2},1}:
 [NaN -0.0596478 … 0.652303 0.657847; NaN -1.84504 … 0.645139 0.620036]

```

for example -0.0596478 in second element of last list.

Is there anyway to check the CI or stdev of the index (not clear form documentation) to see if 0 is included in the index CI - This would be useful to determine if should assume the value of the index to be zero or if I have to rerun the sensitivity analysis with a higher N.

Thanks,

A

---

<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:** [July 23, 2019, 7:46pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/2 "2019-07-23T19:46:27Z")

</div>

@alewolf unfortunately we don’t have any functionality for this yet. We can discuss adding this though, could you open an issue for this?

The negative values do look wrong. I’ll take a look at this, we can move the conversation to the repo I guess that would be easier.

---

<div class="post-metadata">

**Author:** ![alewolf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alewolf/32/9000_2.png) [@alewolf](https://discourse.julialang.org/u/alewolf)\
**Post date:** [July 23, 2019, 9:04pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/3 "2019-07-23T21:04:02Z")

</div>

Ok,  
Thanks for the quick reply!

I’ll open the issue-

Ale

---

<div class="post-metadata">

**Author:** ![agimenezromero](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@agimenezromero](https://discourse.julialang.org/u/agimenezromero)\
**Post date:** [October 21, 2020, 7:12am UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/4 "2020-10-21T07:12:37Z")

</div>

Hi!

Did you open that issue? If so, could you reference it here please?

I’m also interested in getting a confidence interval for the Sobol indices.

---

<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:** [October 23, 2020, 4:46pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/5 "2020-10-23T16:46:25Z")

</div>

@agimenezromero we support CIs now

---

<div class="post-metadata">

**Author:** ![agimenezromero](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@agimenezromero](https://discourse.julialang.org/u/agimenezromero)\
**Post date:** [October 28, 2020, 8:16am UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/6 "2020-10-28T08:16:50Z")

</div>

Awesome! But how does it work? I mean, how can I obtain the CI for each index? I can’t find it…

Sorry for so many questions :s

---

<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:** [October 28, 2020, 8:53am UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/7 "2020-10-28T08:53:32Z")

</div>

In the call to run sobol for example `sobol_result = gsa(f1,Sobol(),A,B)` you can specify `nboot` which is the number of bootstrap samples and `conf_int` for the confidence interval level (defaults to 0.95) as `sobol_result = gsa(f1,Sobol(nboot = 100, conf_int = 0.75),A,B)` and then the output struct contains the fields for the confidence intervals for the first, second and total order indices similar to the indices

---

<div class="post-metadata">

**Author:** ![agimenezromero](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@agimenezromero](https://discourse.julialang.org/u/agimenezromero)\
**Post date:** [November 2, 2020, 8:46am UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-sobol-parameters-confidence-interval-ci/26692/8 "2020-11-02T08:46:04Z")

</div>

OK, thank you very much!
