-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GARCH model with exogenous regressors not functioning? #160
Comments
Unfortunately, I think the arch package seems to support only exogenous variables in calculating the mean, not in estimating the variance. I don't think the package supports what you are looking for, which is a regression for variance as a function of previous returns, previous variance, and this additional dummy value. |
ARCH contributors, is the comment from @dimab0 true? I'm trying to fit the following model: |
What @dimab0 said is correct - there is not support for exogenous variance regressors in the current version. |
@bashtage, thanks for the clarification. Do you know of a Python or R package that does support that functionality? |
I don't know much R package availability, and as far as I know there are
none for Python. pyflux would be the other place to look.
…On Tue, Feb 21, 2017 at 12:17 PM Ken ***@***.***> wrote:
@bashtage <https://github.com/bashtage>, thanks for the clarification. Do
you know of a Python or R package that does support that functionality?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#160 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFU5RbAJqmUiAalAWm7cgDHqSRVF2vnKks5retW-gaJpZM4MGv68>
.
|
Interesting. The professor for the class recommended that we use EViews for class assignments; I was hoping to build my skill set on more widely used platforms (python/R). Is there a reason why exogenous variance regressors are not currently supported? Is this a tool that's not heavily used in the GARCH/financial econometrics space? |
In no particular order:
|
Understood. I'm happy to submit a pull request. I'm just trying to understand the area a little better. Thanks for the quick replies! |
PRs welcome 👍 |
Is there any Makov-Switching GARCH out there on Python? |
It has not been coded in this toolbox and I haven't come across it. |
Is it still true that there is no support for exogenous variance regressors in this package? |
I have not added exogenous regressors for volatility. |
@bashtage do you came across any Vuong test on Python yet? |
Dear all, I am trying to use an ARX model (with exogenous variables) but I don't know how to pass the exogenous variables to the forecast method. I have tried adding a parameter x or exogp with the numpy array of the regressors to the following: But I get the error that x or exgop don't exist. How can I get this problem solved? The model is difined as follows: params = {'lags': [11,14,20,22,28,30,32,37,47], 'volatility': HARCH([1]), 'dist': Normal()} And I only need exogenous regressors for the mean. Many thanks!! |
@camontanezp I think you are missing an argument to forecast. When I do the following:
it works as expected. You are missing |
Not sure if you still care, but rugarch in R does support external regressors for variance. |
Hi, I am struggling with this exact issue, and I am working on a solution. |
The design of arch makes this a bit trickier than ideal since a VolatiltiyProcess usually takes inputs from the Mean model. I think I know how to solve it in a reasonable way to make GARCH-X and EGARCH-X models. |
I go back the arch_model() function code. It needs the "x" to be a 2-dimensional array. If not, then it shows the same error. However, I do not know why "x" should be a 2-dimensional array. After I reshape "x" as a [79,1] array (because I have 79 observations), it yields the following output. If someone is familiar in this field, please give me some comments. Thank you. @bashtage
|
Hi shengnan92, X can be forced to be a 2 dimensional array and still work with only one set of observations because you (the code in this case) can set the 1st array to be zeros. This is a somewhat common thing to do because it allows for generalisation in adding a constant to your model. E.g.: if you want a constant in your model, the 1st X row would be made fully of 1s. |
The issue with the exog shape has been fixed in master. Master and the next release will accept 1d exog as long as it has the right number of observations. |
Hi, I am also having problems with the exogenous model forecast using ARX function in the arch_model library. I have one exogenous continuous variable S&P500 I want to use to help predict the mean log returns of another variable using ARX mean model. I am having issues getting a multi-step forecast horizon. I have tried many fixes based upon the comments in this chain, but nothing is working. Here is a copy of the code that get me one step ahead forecasts.
I'm hoping you can tell me how to correct my code to get multi-step forecast results when I include an exogenous variable. |
There is no support for multistep forecasts with exogenous regressors, so you will need to roll your own. |
Hi @bashtage I'm too having trouble with GARCH model with exogenous regressors. Below is my code and I keep having the value error. Was wondering if you might know where I got it wrong?
|
I still think exog variables haven't been implemented yet. |
Are there any other standard garch implementations in Python? Hard to believe there isn't a package in Python with support for exogenous variance variables |
Hi @kcho5820 , it's a long shot but did you manage to fix this problem? I am having the same issue at the forecasting step. |
Hi @bashtage, since exogenous regressors are still not supported in the variance step, could you elaborate a bit on what you meant by the above re a reasonable way to make GARCH-X models work using |
Hello,
I'm struggling to figure out how to properly use this package to fit a GARCH(1,1) model with an exogenous variable. Here's an example Jupyter notebook to illustrate what I'm trying to do.
In short, using the canonical example of daily S&P 500 returns, I'm trying to add a dummy variable to a GARCH(1,1) model to examine the effect of Mondays. If I fit a model like so,
arch_model(returns, x=mondays).fit().summary()
, the summary output does not include any information for the dummy variable, making me think the variable was ignored altogether.Looking through the ARCH documentation, I found a page specifying that I may need to specify a mean model for exogenous regressors. If I explicitly specify the mean model to be HARX, like so,
arch_model(returns, x=mondays, mean='HARX').fit().summary()
, I receive the following exception:ValueError: x must be nobs by n, where nobs is the same as the number of elements in y
.Am I missing something simple here? I'm trying to use this package for a graduate class in econometrics, and this question is causing some serious pain. Any help would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: