how not to display everything
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
Every time I run the following code it displays lot of extra ouputs. I just need it to display the Aic values at the end.
Can someone please help me ?
much Thanks.
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);
Mdl1 = garch('Offset',NaN,'GARCHLags',1,'ARCHLags',1);
[EstMdl1,EstParamCov1,logL(1)] = estimate(Mdl1,utl);
numParams(1) = sum(any(EstParamCov1));
Mdl2 = garch(5,5);
[EstMdl1,EstParamCov2,logL(2)] = estimate(Mdl2,utl);
numParams(2) = sum(any(EstParamCov2));
numObsv = length(utl);
[AIC1] = aicbic(logL(1), numParams(1))
[AIC2] = aicbic(logL(2), numParams(2))
0 Kommentare
Antworten (1)
Image Analyst
am 3 Jun. 2014
Here, study this function to see how I turn off warnings. The instructions for other warnings that you may encounter that are not turned off by my function are in the comments.
% Suppress warnings.
function TurnOffWarnings()
try
% To set the warning state, you must first know the message identifier for the one warning you want to enable.
% Query the last warning to acquire the identifier. For example:
% warnStruct = warning('query', 'last')
% messageID = warnStruct.identifier
% messageID =
% MATLAB:concatenation:integerInteraction
% Turn off this warning "Warning: Image is too big to fit on screen; displaying at 33% "
warning('off', 'Images:initSize:adjustingMag');
% Get rid of warning about roipolyold being deprecated:
% "Warning: Function ROIPOLYOLD will be removed in the future. Use ROIPOLY instead"
warning('off', 'images:removing:function');
% Get rid of warning about directory already existing:
% "Warning: Directory already exists."
warning('off', 'MATLAB:MKDIR:DirectoryExists');
% Turn off note "Warning: Added specified worksheet." that appears in the command window.
warning('off', 'MATLAB:xlswrite:AddSheet');
catch ME
errorMessage = sprintf('Error in function %s() at line %d.\nDo you have the file already open in Excel?\nPlease check that the file is not open anywhere.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf(1, '%s\n', errorMessage);
WarnUser(errorMessage);
end
return; % from TurnOffWarnings
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!