# How to do the sensitivity analysis of a vector variable

**URL:** <https://uqworld.org/t/how-to-do-the-sensitivity-analysis-of-a-vector-variable/979>\
**Category:** Community Q&A and How To\
**Created:** [December 24, 2020, 9:10am UTC](https://uqworld.org/t/how-to-do-the-sensitivity-analysis-of-a-vector-variable/979 "2020-12-24T09:10:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IHM](https://uqworld.org/letter_avatar_proxy/v4/letter/i/fbc32d/32.png) [@IHM](https://uqworld.org/u/IHM)\
**Post date:** [December 24, 2020, 9:10am UTC](https://uqworld.org/t/how-to-do-the-sensitivity-analysis-of-a-vector-variable/979/1 "2020-12-24T09:10:09Z")

</div>

Hello! is it possible to perform the sensitivity analysis then the reliability of a model with a vector variable as input. in fact i want to do the analysis of a finite element model on external software and one of my variables is the load. In my case it is a cyclic loading and in the model used the loading is in the form of a vector (1xN with N the number of cycles). Thank you for your help

---

<div class="post-metadata">

**Author:** ![Michael\_Baudin](https://uqworld.org/user_avatar/uqworld.org/michael_baudin/32/425_2.png) [@Michael\_Baudin](https://uqworld.org/u/Michael_Baudin)\
**Post date:** [December 25, 2020, 3:19pm UTC](https://uqworld.org/t/how-to-do-the-sensitivity-analysis-of-a-vector-variable/979/2 "2020-12-25T15:19:33Z")

</div>

Hi,

This is indeed not as simple as with a scalar output.

However, one possibility is to aggregate the sensitivity indices of all outputs.  
This is advocated in Gamboa, F., Janon, A., Klein, T. & Lagnoux, “A. Sensitivity analysis for multidimensional and functional outputs.” 2013. The trick is to sum the variances of the conditional expectations and scale with respect to the sum of variances.

Assume that there are n\_X inputs and n\_Y outputs. Denote by Y\_k the k-th output, for k=1,\ldots, n\_Y. Let V\_i^{(k)} be the (first order) variance of the conditional expectation of the k-th output with respect to the i-th input, for i=1,\ldots, n\_X and k=1,\ldots, n\_Y. Then the aggregate first order Sobol’ indice is:

S\_i = \frac{\sum\_{k=1}^{n\_Y} V\_i^{(k)}}{\sum\_{k=1}^{n\_Y} Var(Y\_k)}

for i=1,\ldots, n\_X.

This is explained in Gamboa et al’s article and in:

> **[SobolIndicesAlgorithm — OpenTURNS 1.17dev documentation](http://openturns.github.io/openturns/master/user_manual/_generated/openturns.SobolIndicesAlgorithm.html#openturns.SobolIndicesAlgorithm)**

Best regards,

Michaël

---

<div class="post-metadata">

**Author:** ![IHM](https://uqworld.org/letter_avatar_proxy/v4/letter/i/fbc32d/32.png) [@IHM](https://uqworld.org/u/IHM)\
**Post date:** [December 29, 2020, 9:30am UTC](https://uqworld.org/t/how-to-do-the-sensitivity-analysis-of-a-vector-variable/979/3 "2020-12-29T09:30:23Z")

</div>

Hello! sorry for the delay; it is true that it is quite complex even to understand. Please don’t you have an example code for this?  
happy end of year party!

---

<div class="post-metadata">

**Author:** ![Michael\_Baudin](https://uqworld.org/user_avatar/uqworld.org/michael_baudin/32/425_2.png) [@Michael\_Baudin](https://uqworld.org/u/Michael_Baudin)\
**Post date:** [January 30, 2021, 9:00pm UTC](https://uqworld.org/t/how-to-do-the-sensitivity-analysis-of-a-vector-variable/979/4 "2021-01-30T21:00:59Z")

</div>

Hi,  
I think you can find a complete example of sample-based algorithms for sensitivity analysis here:  
[http://openturns.github.io/openturns/master/auto\_reliability\_sensitivity/sensitivity\_analysis/plot\_sensitivity\_sobol.html](http://openturns.github.io/openturns/master/auto_reliability_sensitivity/sensitivity_analysis/plot_sensitivity_sobol.html)  
In order to get the aggregated indices, you just have to replace `getFirstOrderIndices` in the example with `getAggregatedFirstOrderIndices`, and that’s done. The maths remains complicated, but the code does not 🙂  
Notice that I fixed some details in the example for you at:

> <https://github.com/openturns/openturns/pull/1706>

This should be integrated within a few weeks.  
Best regards,  
Michaël  
PS  
I did not notice your answer: I configure the e-mail remainder as soon as I push on the “Reply” button!
