# Sensitivity analysis

Imagine that you have a process with a complicated formula.
For instance, we model a piece of land used for growing wheat.
This piece of land is a square with a specified length: `length = 500 m`

.
Only a fraction this land is actually used to grow the crop: `area_usage = 0.95 u`

.
And, finally, the farming technology is characterized by `yield = 300 kg / 10000 m2`

.
Say you want to assess the unitary impact, in terms of land use, of the wheat so produced.
One could write something like that:

```
process p {
params {
length = 500 m
area_usage = 0.95 u
yield = 300 kg / 10000 m2
}
products {
1 kg wheat
}
variables {
area = length^2.0
crop_area = area_usage * area
ratio = yield / 1 kg
}
impacts {
area / (ratio * crop_area ) LU
}
}
```

Assessing this process yields the following results

Item | Quantity | Unit | LU [m2] |
---|---|---|---|

wheat | 1 | kg | 35 |

Now, what happens if the yield increases by 1%? or the length, or area_usage?
If we develop the formula, the unitary impact is `1 kg / (yield * area_usage)`

. Therefore, we should expect the following behaviour:

- Increasing
`length`

by 1% should not influence the unitary impact. The sensitivity coefficient is 0. - Increasing
`yield`

by 1% should decrease the unitary impact by 1%. The sensitivity coefficient is -1. - Increasing
`area_usage`

by 1% should decrease the unitary impact by 1%. The sensitivity coefficient is -1.

Of course, the analytic formula of an impact is not easy to derive. The next sections presents two ways to compute numerical approximations of these sensitivity coefficients.

## Manual approach

Of course, one way to do it is to manually vary the parameter value. For instance,

```
process p_vary_yield {
params {
length = 500 m
area_usage = 0.95 u
yield = (300 kg / 10000 m2) * 1.01 u
}
products {
1 kg wheat
}
variables {
area = length^2.0
crop_area = area_usage * area
ratio = yield / 1 kg
}
impacts {
area / (ratio * crop_area ) LU
}
}
```

Assessing this process yields

item | quantity | unit | lu [m2] |
---|---|---|---|

wheat | 1 | kg | 34.7 |

Therefore, the variation of the unitary impact is `34.7/35 - 1`

, that is about `-1 %`

.
In other words, the sensitivity coefficient is `-1`

.

However, repeating this procedure for every parameter is cumbersome, especially if you have lots of parameters.

## Direct approach

Click on the icon ⏵ for the process `p`

.
You should see an action named `Analyze sensitivity`

.
Clicking on it yields the following table

name | amount | unit | LU |
---|---|---|---|

length | 500 | m | -2.32e-16 |

area_usage | 0.95 | u | -1 |

yield | 0.03 | kg.m2⁻¹ | -1 |

This table displays the sensitivity coefficients the impact with respect to each parameter.
It is found indeed that the sensitivity coefficients of `area_usage`

and `yield`

equal `-1`

.
The sensitivity coefficient of `length`

, however, is very small,
but not exactly zero (you may even see a different value).
This is because these results are numerical approximations.