Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## biosig-general

 Re: [Biosig-general] Matlab BioSig Toolbox From: Alois Schloegl - 2012-04-03 07:48:57 ```On 04/03/12 00:59, si pal wrote: > > > Dear Dr. Alois Schloegl, I have downloaded your Matlab BioSig toolbox > just to learn about the algorithms and play with it so I can > understand the theory better. I have a question if you don't mind me > asking? Does the "TSA" time-series package that comes with the > BioSig Toolbox contain any codes that can do forecasting? Say, I > have a tme-series W which has a length of 200 and I want to > forecast the next 5 time-steps, ie, I want to know what will be the > values in W+1, W+2, W+3, W+4, W+5 ? Is this something possible to > do with the TSA in the BioSig Toolbox? If there's no example of > forecasting in the TSA package but it is possible to do it with TSA, > would you be kind enough to give me an example of how to do that? > Sorry, if my question sounds stupid as I'm new to signal processing. > Any hint would be much appreciated. Regards,Si. Pal. The TSA-toolbox is build around (various types of) Autoregressive (AR) models, it's a stochastic (not a deterministic) model. This means it is based on probability theory rather than differential equations. There is vast amount of literature on it. The AR model itself does single step prediction. However, there are several approaches to extend the prediction horizon. (i) change the size of the time steps, y(t) is a vector of sample values A1 = lattice(y,p); e1 = filter([1,-A1],1,y); % increase step size y2 = y(1:2:end),repmat(NaN,1,p),y(2:2:end)] A2 = lattice([y2, p); e2 = filter([1,-A2], 1, y2); % increase step size y3 = y(1:3:end),repmat(NaN,1,p),y(2:3:end),repmat(NaN,1,p),y(3:3:end)] A3 = lattice(y3, p); e3 = filter([1,-A3],1,y3); A possible pitfall is aliasing. (ii) or use the predicted value to estimate the next step of the prediction (it will produce a good estimation of the expected value, but will underestimate the variability). A = lattice(y,p); % one-step prediction y1 = filter([0,A],1,y); e1 = y-y1; % two step prediction y2 = filter([0,0,A(2:end)],1,y)+filter([0,A(1)],1,y1); e2 = y-y2; % three step prediction y3 = filter([0,0,0,A(3:end)],1,y)+filter([0,A(1)],1,y2)+filter([0,0,A(2)],1,y1); e3 = y-y3; Something along these lines should do the job. Kind regards, Alois ```