uncertainpy icon indicating copy to clipboard operation
uncertainpy copied to clipboard

The confidence level

Open piotrt75 opened this issue 5 years ago • 1 comments

Hi, Is the 'prediction interval' same as 'confidence level' ? If yes, then is there a way to set it to 95% (k~2) ? Thanks, Piotr

piotrt75 avatar Apr 11 '20 21:04 piotrt75

Hi Piotr,

The prediction interval and confidence interval are related but not the same. You can find a more detailed explanation here:

https://towardsdatascience.com/how-confidence-and-prediction-intervals-work-4592019576d8

A summary from that article:

"The prediction interval predicts in what range a future individual observation will fall, while a confidence interval shows the likely range of values associated with some statistical parameter of the data, such as the population mean."

Unfortunatly there is no good way of changing from 90 to 95% prediction interval, but it can easily be changed from whithin the Uncertainpy code. You need to look at uncertainpy/src/uncertainpy/core/uncertainty_calculations.py.

If you are using polynomial chaos expansion you change (in the analyse_pce function):

data[feature].percentile_5 = np.percentile(U_mc[feature], 5, -1)
data[feature].percentile_95 = np.percentile(U_mc[feature], 95, -1)

to:

data[feature].percentile_5 = np.percentile(U_mc[feature], 2.5, -1)
data[feature].percentile_95 = np.percentile(U_mc[feature], 97.5, -1)

And if you are using monte carlo you change (in the monte_carlo function):

data[feature].percentile_5 = np.percentile(masked_evaluations, 5,
data[feature].percentile_95 = np.percentile(masked_evaluations, 95, 0)

to:

data[feature].percentile_5 = np.percentile(masked_evaluations, 2.5,
data[feature].percentile_95 = np.percentile(masked_evaluations, 97.5, 0)

simetenn avatar Apr 16 '20 05:04 simetenn