Hmm, are you looking at github or launchpad? I don't think there's
this distinction on github? We are hosting the code now on github at
https://github.com/statsmodels/statsmodels
You have two options, one click on the download button then either
grab the tarball or the zip. That will be the source of the most
current code. Note that the forecast stuff isn't merged into master
yet, but I'll do that shortly.
Or you could install git. You can find instructions for installing it
here, http://statsmodels.sourceforge.net/dev/git_notes.html#getting-started-with-git
You shouldn't need any of the other information on that page unless
you want to contribute. Then you just need to do
http://statsmodels.sourceforge.net/install.html#obtaining-the-source
to get the source.
> The other thing that would be great to know, is if there's a way to
> include exogenous variables in the vector auto-regressive model? I
> guess this is normally referred to as VARX. I didn't see anything for
> this in the stable release on soruceforge, but is it possible that
> it's been included in the development version?
>
I don't think VAR is setup for exogenous variables yet. Wes? I'm going
to be looking at this over the coming days, and I'll let you know when
it's up.
> Ideally, I'd like something where I could do the fit to my
> multivariate model on historical endogenous+exogenous data, then feed
> it (separately determined) exogenous forecasts for n-steps out, and
> get the n-steps out forecasts for the endogenous variables
>
Sure.
> Thanks again!
No problem. Good to know it's getting used. Will try to accommodate
the feature requests.
Skipper
As far as I could see, VAR doesn't take exog, but it includes trend in
some parts and exogs could be treated in a similar way.
Does SVAR do anything with exogs or trend?
Josef
No, not yet. Neither SVAR nor VAR are setup to take exogenous variables yet.
Bart
Best help to get started with a feature request would be a test case.
We are always short in test cases, and adding features, or writing new
functionality is much easier and faster if we don't have to go and
hunt for test examples.
Thanks and Cheers,
Josef
The ARMAResults class now has a forecast method, if you want to grab
the source. It returns the forecast, forecast errors, and the
confidence intervals. I can't guarantee the API won't change once we
hook the TSA models into pandas better before the next release, FYI.
Ah, this will be a nice example. Will have a look at VARX (and
probably seasonality in ARMAX) soon. As always patches welcome.
If you get ambitious and want to make a proper 'dataset' out of this,
there are instructions here.
http://statsmodels.sourceforge.net/devel/dev/dataset_notes.html#adding-a-dataset
Thanks,
Skipper
It's not in the last release. It's only in master. You'll have to
install from github.
> To be more precise, that's the one in scikits.statmodels.tsa.arima_model,
> and which I got by fitting an scikits.statsmodels.tsa.arima_model.ARMA
> object (just in case there were multiple definitions of these things).
>
> I've also tried using the code snippet you posted earlier in this convo, but
> I'm getting an out-of-range index error.
>
It *should* work, though there could've been a bug. Can you try using this one
https://github.com/statsmodels/statsmodels/blob/master/scikits/statsmodels/tsa/arima_model.py#L674
Just pull it out to a function and pass your ARMAResults instance for
the self argument.
If you still get the error can you post some code to reproduce?
Skipper
It *should* work, though there could've been a bug. Can you try using this one
https://github.com/statsmodels/statsmodels/blob/master/scikits/statsmodels/tsa/arima_model.py#L674
Just pull it out to a function and pass your ARMAResults instance for
the self argument.
If you still get the error can you post some code to reproduce?
Skipper
On Wed, Sep 21, 2011 at 12:08 PM, Michael Schmidt <elmic...@gmail.com> wrote:It's not in the last release. It's only in master. You'll have to
> I've just had a chance to re-install the code and try using
> ARMAResults.forecast, but I can't seem to find it. I'm using version 0.3.1,
> and there doesn't appear to be a forecast method in ARMAResults.
>
install from github.
I think you can change this to
for i in range(min(q,steps-1)):
and it will work, though I'm not yet sure if it'll be robust without
thinking more. I've rewritten all of the predict stuff for tsa in the
pandas-integration branch, and this is the last thing that I haven't
done. ARMA is still in-sample only, so I'm going to hold off on
patching this until I am doing it with the new machinery. I am going
to update it soon though, hopefully towards the end of the week, and I
will add test cases to make sure this is covered adequately. Thanks
for the report, and please let me know if there's anymore trouble.
Skipper
No, they're not supposed to be nested. Just put i = 0 under if q.
Corner cases...this is why I was waiting for the dates machinery to be
in place to really do prediction in the tsa models. It makes it a bit
easier to keep everything straight.
if q:
i = 0 # in case q == steps == 1
resid = np.zeros(2*q)
resid[:q] = self.resid[-q:] #only need last q
You also need these imports at the top of your script
from scikits.statsmodels.tsa.arima_process import arma2ma
from scipy.stats import norm
Hi, Mike and Skipper, I am trying predicting using ARMA too. During study, I
want
to estimate ARMA parameters using Powell. So it's appreciate to anticipate
your discussion on predicting using arma_model package. Yet I have little
experience on Python programme, so it's a little difficult for me to use
arma_model package. Further it seems difficult to find demos or examples for
arma_model use at this time. So could you pass me some examples or links of
examples about ARMA predicting? Thanks.
Hi,
You'll find an example here:
http://statsmodels.sourceforge.net/devel/examples/generated/ex_arma2.html
To predict, you can just do
pred = arma_res.predict(start="1999-8-31", end="2000-8-31")
Or if you don't use pandas.
arma_mod2 = ARMA(y.values, freq='M')
arma_res2 = arma_mod2.fit(order=(2,2), trend='nc', disp=-1)
pred = arma_res2.predict(start=230, end=248)
I just fixed a small buglet with ARMA predict in master, so you'll
need to use master or wait until this evening when I am able to put up
a new release candidate.
Skipper
Hi,Skipper
1.environment:
python2.6
scipy-0.10.1-win32-superpack-python2.6
numpy-1.6.1-win32-superpack-python2.6
scikits.statsmodels-0.3.1.tar
And the GET START code has passed successfully with warning:
"
Warning (from warnings module):
File "C:\Python26\lib\scikits\statsmodels\tools\tools.py", line 256 "next
release, use explicit prepend", FutureWarning)
FutureWarning: The default of `prepend` will be changed to True in the next
release, use explicit prepend.
"
2.test code(originated from
http://statsmodels.sourceforge.net/devel/examples/generated/ex_arma2.html)
import numpy as np
import scikits.statsmodels.api as sm
##import scikits.statsmodels as sm
from scikits.statsmodels.tsa.arima_process import arma_generate_sample
from scikits.statsmodels.tsa.arima_model import ARMA
arparams = np.array([.75, -.25])
maparams = np.array([.65, .35])
arparams = np.r_[1, -arparams]
maparam = np.r_[1, maparams]
nobs = 250
y = arma_generate_sample(arparams, maparams, nobs)
y
##import pandas
##
##dates = sm.tsa.datetools.dates_from_range('1980m1', length=nobs)
##y = pandas.TimeSeries(y, index=dates)
arma_mod = ARMA(y, freq='M')
##throw Error:Traceback (most recent call last):
File "D:\data\python\arma\arma_powell", line 23, in <module>
## arma_mod = ARMA(y, freq='M')
## TypeError: __init__() got an unexpected keyword argument 'freq'
##arma_mod = ARMA(y)##tested no error throwed yet without result;
##arma_res = arma_mod.fit(order=(2,2), trend='nc', disp=-1)
##predict
##arma_mod2 = ARMA(y.values, freq='M')
##arma_res2 = arma_mod2.fit(order=(2,2), trend='nc', disp=-1)
##pred = arma_res2.predict(start=230, end=248)
3 why error:
I have checked the package scikits by open File->Path Browser->%Python26
installed dir%\lib. And found that the class ARMA embeded
in scikits:package->statsmodels:package->tsa:package->arima_model.py->class
ARMA(LikelihoodModel) just had method __init__(self, endog, exog=None):
which refused to accept parameter "freq='M'" and threw the error.
4 solutions?
So it seems that I have to update package to 0.4? Yet I found no 0.4 for
python26,is there? If I would like to keep python26(some other softwares based
on installed python26), is there some solution?
Thanks for response.
ARMA does not take a freq keyword with 0.3.1.
> ##arma_res = arma_mod.fit(order=(2,2), trend='nc', disp=-1)
> ##predict
> ##arma_mod2 = ARMA(y.values, freq='M')
> ##arma_res2 = arma_mod2.fit(order=(2,2), trend='nc', disp=-1)
> ##pred = arma_res2.predict(start=230, end=248)
> 3 why error:
> I have checked the package scikits by open File->Path Browser->%Python26
> installed dir%\lib. And found that the class ARMA embeded
> in scikits:package->statsmodels:package->tsa:package->arima_model.py->class
> ARMA(LikelihoodModel) just had method __init__(self, endog, exog=None):
> which refused to accept parameter "freq='M'" and threw the error.
> 4 solutions?
> So it seems that I have to update package to 0.4? Yet I found no 0.4 for
> python26,is there? If I would like to keep python26(some other softwares based
> on installed python26), is there some solution?
We just put a new version here
https://github.com/statsmodels/statsmodels/downloads
Let us know if you have any trouble with it.
Skipper