please help with the errror
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I am trying to run the following program but it doesnt identify the function and gives me an error. can someone please help me with it?
code:
clc;
clear;
T = 300;
a0 = 0.1; a1 = 0.4; a2 = 0.0; b1 = 0.2; b2= 0.0; % garch parameters
epsi = randn(T+2000,1);
ut = zeros(T+2000,1); % garch data
sig2 = zeros(T+2000,1); % sigma squared in garch model
unvar = a0/(1-a1-a2-b1-b2); % unvar is the unconditional variance.. initial condition
for i = 1:T+2000
if i==1
sig2(i) = a0 + a1*unvar + a2*unvar + b1*unvar + b2*unvar;
sig =(sig2(i))^0.5;
ut(i) = epsi(i) * sig;
elseif i==2
sig2(i) = a0 + a1*(ut(1))^2 + a2*unvar + b1*sig2(1)+ b2*unvar;
sig =(sig2(i))^0.5;
ut(i) = epsi(i) * sig;
else
sig2(i) = a0 + a1*(ut(i-1))^2 + a2*(ut(i-2))^2 + b1*(sig2(i-1)) + b2*(sig2(i-2));
sig=(sig2(i))^0.5;
ut(i) = epsi(i) * sig;
end
end
utl = ut(2001:T+2000);
model1 = garch('Offset',NaN,'GARCHLags',1,'ARCHLags',1);
[fit1,~,LogL1] = estimate(model1,utl);
error:
Undefined function 'garch' for input arguments of type 'char'.
Error in test (line 32)
model1 = garch('Offset',NaN,'GARCHLags',1,'ARCHLags',1);
1 Kommentar
Antworten (1)
James Kristoff
am 27 Mai 2014
As Star Strider stated, the command garch is part of the Econometrics Toolbox. If you want to find out if you have this toolbox installed, you can use the ver command.
which -all plot
will list the locations of all plot functions on the MATLAB path.
1 Kommentar
James Kristoff
am 27 Mai 2014
You can install the toolbox if it is on your license, or if you buy it. I am sure that you could do the math to "estimate the orders of p and q of a garch data set" without this function, but you would have to look up the related equations and implement them yourself in MATLAB. I do not know enough about this application to help implement the function by hand.
Siehe auch
Kategorien
Mehr zu Conditional Variance Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!