brightway-lca / brightway2-calc

The calculation engine for the Brightway2 life cycle assessment framework.
BSD 3-Clause "New" or "Revised" License
14 stars 16 forks source link

Use the expected value to parametrize lognormal distributions #76

Closed Loisel closed 1 year ago

Loisel commented 1 year ago

I find it confusing that Brightway identifies the geometric mean of the lognormal distribution (i.e., the median of the distribution) with the amount given for an exchange when importing Ecospold2. I'm aware that this is in line with the ecospold specs, but in my opinion, it makes much more sense to choose the mean of the underlying normal distribution, $\mu$, such that the expected value for the resulting distribution (mean) is equal to the amount specified for the exchange. This approach is also followed by SimaPro as far as I can tell.

As can be seen here, I'm not the only one to find it confusing that the mean value from a MonteCarlo run is always noticeable above the static result.

The topic is also discussed in notebooks by @cmutel here, and here.

As far as I can tell, the discrepancy accumulates over the supply chain and eventually leads to resulting distributions with the static result being well below the median of the distribution.

I created a notebook where I reparametrized the lognormals choosing $\mu$ such that the expected value matches the amount of the exchange (basically following the steps described here), and did some basic tests. I cannot easily share the notebook in this issue, but the results look promising: average_vs_median

Shown are the ratios of a static LCA result vs the mean of MonteCarlo runs for 100 random processes and a random method for the original database and a version where I replaced $\mu$.

cmutel commented 1 year ago

@Loisel What would be your proposal here? I am not sure changing the default is great, it will upset quite a lot of people. But we could interpret the median as the mean, especially if we make this an optional config parameter.

Honestly I am not sure that ecoinvent has an official position on this. We can just do something as long as we can justify it.

Loisel commented 1 year ago

I do not understand what you mean by "interpret the median as the mean". What about having a parameter when creating the importer object, i.e., SingleOutputEcospold2Importer, for example reparametrize_lognormal=True or maybe something more concrete? I can prepare a PR if there are no objections.