Hello,
I have the following funtion:
function Beta = arima(y, p, q, C, sigma)if nargin < 4C = 0;endif nargin < 5sigma = 1;endy = y(:);N = length(y);e = sigma * randn(N, 1);Y = y - e;% By = y(1:end-1) y(1:end-2) ... y(:, end-p)
By = arrayfun(@(j) [zeros(j,1); y(1:end-j)], 1:p, 'UniformOutput' , false); By = [By{:}];Be = arrayfun(@(j) [zeros(j,1); e(1:end-j)], 1:q, 'UniformOutput' , false); Be = [Be{:}];if C == 0cvec = [];elsecvec = ones(N,1);endX = [cvec By Be];Beta = Y\X;end
and I am trying to call it in the following code:
a0 = 0.05; a1 = 0.1; b1 = 0.85;epsi=zeros(3000,1);simsig=zeros(3000,1);for i = 1:3000 if (i==1) simsig(i) = a0 ; s=(simsig(i))^0.5; epsi(i) = normrnd(0,1) * s; else simsig(i) = a0+ a1*(epsi(i-1))^2+ b1*simsig(i-1); s=(simsig(i))^0.5; epsi(i) = normrnd(0,1) * s; endendyt1=epsi.^2;Beta = arima(yt1, 1, 1, 0.05, 1);
But I get the following error msg:
Attempt to execute SCRIPT arima as a function:F:\MATLAB\arima.mError in aa (line 21)beta = arima(yt1, 1, 1, 0.05, 1);*
I have both saved in the same folder. What should I do?
Thanks
Best Answer