Can anyone help with below code?
My code as below
In[152]:
sample = kde.resample(43826)
5 ** np.percentile(sample, 5)
In[153]:
def resample_kde_percentile(kde):
sample = kde.resample(kde.n)
return 5 ** np.percentile(sample, 5)
In[154]:
def summarize(t, digits=2):
table = pd.DataFrame(columns=['Estimate', 'SE', 'CI90'])
est = np.mean(t).round(digits)
SE = np.std(t).round(digits)
CI95 = np.percentile(t, [5, 95]).round(digits)
table.loc[''] = est, SE, CI95
return table
In[155]:
t10 = [resample_kde_percentile(kde)
for i in range(1000)]
summary10 = summarize(t10)
summary10
I am trying to find the upper and lower limit using KDE bootstrapping.
steps
- Find residual of Actual and prediction.
- Normalize the residuals
- KDE of residuals
- resampling KDE
- find the upper and lower limit
- create Prediction interval.