Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Predicting ARMA model: where does the delay come from?
Posted:
Nov 9, 2011 7:24 AM
|
|
"Aino" <aino.tietavainen@removeThis.helsinki.fi> wrote in message <j90j6b$l0v$1@newscl01ah.mathworks.com>... > Rune Allnor <allnor@tele.ntnu.no> wrote in message <6234421e-b5bd-4ecd-b9b3-b9f0b9638587@h34g2000yqd.googlegroups.com>... > > On 4 Nov, 12:00, "Aino" <aino.tietavai...@removeThis.helsinki.fi> > > wrote: > > > Hello all! > > > > > > I am trying to model my time series with ARMA model and then predict the signal with 'predict'. Here's an example: > > > > > > close all;clear all;clc; > > > k=25;%prediction step > > > mAR=10;%AR order > > > mMA=10;%MA order > > > > > > %First signal: > > > y=smooth(rand(1500,1),100); > > > y=y(250:end-251); > > > y=y-mean(y); > > > data=iddata(y,[],0.01); > > > m=armax(data,[mAR,mMA]); > > > yp=predict(m,data,k); > > > figure;plot(y);hold on;plot(yp.OutputData,'r') > > > > > > %Second signal: > > > y=sin(1:0.01:10)'; > > > data=iddata(y,[],0.01); > > > m=armax(data,[mAR,mMA]); > > > yp=predict(m,data,k); > > > figure;plot(y);hold on;plot(yp.OutputData,'r') > > > > > > The prediction signal (yp.OutputData) seems to have no delay with the second signal (sine wave), but compared to the first signal it is delayed about the prediction step. The signals I use look more like the first one, so this certainly will affect my prediction error, something like sqrt(sum((data.OutputData-yp.OutputData).^2)). > > > > > > Where does this delay come from and how can I get rid of it? Why does it only affect the first signal? > > > > > > Thank you, > > > Aino > > > > I don't have the toolbox or functions you use in your > > simulation, but I see that you in the second example > > use a noiseless sinusoidal, whereas you in the first > > example use a random signal. > > > > From a prediction POV that makes all the difference: > > > > 1) Sinusoidals are perfectly predictable at the outset. > > 2) There is no noise to messthings up. > > > > So the second example is so perfect that it is totally > > useless for anything other than a test of concept or > > implementation. > > > > The results from your first example are far more > > representative for how the method will work with > > random signals. > > > > Rune > > Thank you for your quick reply. > > The sine wave is indeed almost perfectly predicted, and obviously the noisy signal cannot be so perfectly predicted, but what I cannot understand is that why is there a _delay_ in the prediction with the noisy signal? In other words, if I move the prediction signal by 25 steps and calculate the prediction error, sqrt(sum((data.OutputData(1:end-25+1)-yp.OutputData(25:end)).^2)), it is a lot smaller smaller than without moving it, sqrt(sum((data.OutputData(25:end)-yp.OutputData(25:end)).^2)). With the sine wave this is not true. > > Should I for example use the 'predict' with the time-reversed signal as well and calculate the average of the two predictions or should I just calculate the prediction error as above or what should I do? > > ~Aino
I still haven't figured this one out, but I have a little question about the model. What exactly is the loss function that the armax function gives out? How is it calculated?
Thanks, Aino
|
|
|
|