wwrechard / pydlm

A python library for Bayesian time series modeling
BSD 3-Clause "New" or "Revised" License
475 stars 98 forks source link

Residual Time Series #5

Open simonzcaiman opened 7 years ago

simonzcaiman commented 7 years ago

Hi,

Thanks for offering such a great DLM module. It is a very nice tool to have in Python. I'm wondering if I can find the regression residual time series anywhere. I want to do some analysis on the residuals of the DLM, so that I can better understand the performance of the model. Thanks!

wwrechard commented 7 years ago

Thanks for your suggestion! A simple work-around for now is to computed it like the following assume data is your data, mydlm is the model

residual = [data[i] - mydlm.result.filteredObs[i] for i in range(len(data))]

Will include the residual method in next release.

wwrechard commented 7 years ago

Hey,

You shall now be able to get the residual by calling

mydlm.getResidual(filterType='forwardFilter')
mydlm.getResidual(filterType='backwardSmoother')