Path: news.mathworks.com!not-for-mail
From: "Rajiv Singh" <rajiv_singh@msn.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Prediction with ARMAX
Date: Mon, 23 Feb 2009 09:39:44 -0500
Organization: HOME
Lines: 72
Message-ID: <gnucf2$nip$1@fred.mathworks.com>
References: <gnjsoq$9ld$1@fred.mathworks.com>
Reply-To: "Rajiv Singh" <rajiv_singh@msn.com>
NNTP-Posting-Host: singhr.mi.mathworks.com
X-Trace: fred.mathworks.com 1235399970 24153 172.30.27.201 (23 Feb 2009 14:39:30 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 23 Feb 2009 14:39:30 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:520184


Hi Mehmet,
Your model structure selection should primarily be guided by your knowldge 
of (or desire to capture) the underlying dynamics. For example, choose 'nk' 
based on what the perceived delay in the model is, and not based on how far 
in future you want to forecast result.

So I would not advice shifting data or setting 'nk' to 7. Instead, try out 
various model orders (low to high) and use the one that seems to provide the 
best fit to your data. This can be ascertained using COMPARE function. For 
example, you can check how well your model simulates (M = Inf) or how well 
it performs 7 step-ahead prediction (M=7):
COMPARE(DATA, MODEL, M)

What prediction horizon to use in COMAPRE or PREDICT depends upon how you 
intend to use the model. If you are using model always to forecast results 
using I/O data collected under similar settings (similar noise/disturbance 
profile), then you could just validate your model using M = 7. However, if 
you are interested in checking how well the underlying dyanamics have been 
captured (which is a more severe validation test than finite horizon 
prediction), use M = Inf.

This is what I do usually: I generate a bunch of candiate models (various 
types and orders) and use M = Inf in COMPARE to check how well they fit a 
validation data set. Then I select the one which provides the best fit while 
not using too high orders. I then use the model as required for prediction 
or simulation.

HTH,
Rajiv

"Mehmet Demirel" <mecudem@yahoo.com> wrote in message 
news:gnjsoq$9ld$1@fred.mathworks.com...
> Question is about data introduction to armax: M is a two column matrix 
> containing output (y) and input (u) time series. Each row is the 
> measurement of the same day, no day shift. Desired model structure with a 
> lead time of 7 days;
> y(t) = B(q)u(t-7) + C(q)e(t)
>
> Do i need to introduce the data with a 7 row shift like this (target 
> starts at 8th day);
> Input_calib =M(1:7664,2)
> Target_calib=M(8:7671,1);
>
> Or it is not necessary as i can set Armax parameter "nk" as 7 for the same 
> purpose?
>
> zcalib = iddata(y,u); %y output, u input
> Armafit = armax(zcalib,'na',0,'nb',1,'nc',1,'nk',7);
> Results:
> y(t) = B(q)u(t) + C(q)e(t)
> B(q) = 0.7437 (+-0.009438) q^-7
> C(q) = 1 + 0.873 (+-0.007281) q^-1
>
> Second part of my question;
> To make a realisation of the model in validation part;
>
> predict(Armafit,zvalid,inf) or predict(Armafit,zvalid,7) should be 
> selected?
>
> I think first one should be used according to this information available 
> at the link below..
> YP = PREDICT(Z,TH,M)
> M = inf gives a pure simulation of the system.(Default M=1).
>
> But i am still not sure with lead time if it becomes 7+1 and 8 days since 
> default m is one...
> Ref: http://jisao.washington.edu/vimont_matlab/System/predict.html
>
> Cheers,
> mehmet, loves knowledge share