Apply model to new data?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
The thread is a usage question about applying a fitted GARCH model to new data via arch_model, .fit, and .forecast (including the params= argument). Read the forecast method and any docs on bootstrap forecasts and exogenous x. Reproduce the snippet that yields different self.fcst vs test_fcst, then decide whether the API already supports out-of-sample application or needs a documented/params fix. Done means a clear answer or a small API/docs change that makes applying a fitted model to new series unambiguous.
Written by the indexing model from the issue text.
Description
I was wondering if there's a way to create a model and then apply it to new data.
What I'm trying to do is: bootstrap data, create/fit model for a bootstrap, apply that model to original data. At first I thought maybe the new data could be passed in to "forecast" as it is in some other python packages, but I didn't see anything in the docs for that.
I did see that params can be passed in and so I'm wondering if that's the correct approach. How I was visualizing that is: bootstrap data, create/fit model, create/fit a new model and then forecast with that model but pass the original params. This seems a little convoluted since I'm not sure why I'd need to fit the new model conceptually, but since .forecast is a method on .fit and it seems necessary there.
I tried to build up to seeing if the params approach would work, but I'm running into an issue. I'll share the general idea/code here to see if that sheds light on anything obvious, but if not I can create a full example too. Basically I was creating/fitting a model and then forecasting with it (not on other data, just on the same data), which gave me a set of parameters and forecasts. I then re-attempted the forecast and set the params to be the same as the original model, but was getting different forecast values (everything else was kept the same).
Below I'm getting different values for self.fcst and test_fcst:
# Run the model
garch_model = arch_model(self.depen_data, x=self.indep_data, mean=mean, vol="Garch",
p=p, o=o, q=q, power=power, dist=dist)
self.res = garch_model.fit()
params = self.res.params
# create forecast
predict_length = self.horizon + self.lag
self.fcst = self.res.forecast(horizon=predict_length,
method="bootstrap", reindex=False, x=self.fcst_indep_data)
test_fcst = self.res.forecast(params=params, horizon=predict_length,
method="bootstrap", reindex=False, x=self.fcst_indep_data)
So my question is whether either of these approaches (or any other pre-existing approach) is correct and, if the params approach is correct, whether someone has insight on what I'm doing wrong.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 298
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 106
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bashtage/arch
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 22/100
bashtage/arch#801 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Import errors are swallowed: PerthImplicitWatermarker silently becomes NonePossibly taken @JonRC claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
resemble-ai/Perth#23 ·
-
correction metadata
Difficulty 2/5 Under an hour Newbie friendliness 65/100
acl-org/acl-anthology#10753 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
earthtojake/text-to-cad#758 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
DataTalksClub/faq#545 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day