Catching errors when estimating ARIMA model
Show older comments
Hello: I have the following code that tries to fit an ARMA(1,0,1) to a time series. I want to put AR coefficients in a vector, but when the estimation doesn't have an AR term, the code shows a 'Subscripted assignment dimension mismatch'. How can I use a try... catch to solve this error? I think if I know the name of the error - see line 8 in code - I might be able to catch it
Thanks!
for i=1 : m-Min_Days-1
[EstARIMA,EstParamCov] = estimate(arima(1,0,1),y(1:i+Min_Days),'E0',y(1));
exp_mean(i,1)=forecast(EstARIMA,1)*252;
exp_mean;
try
parameters6(i,1)=cell2mat(EstARIMA.AR);
catch ME
if HOW DO I NAME THE ERROR??
msg = 'No AR';
causeException = MException('MATLAB:myCode:dimensions',msg);
ME = addCause(ME,causeException);
end
rethrow(ME)
end
end
Answers (0)
Categories
Find more on Conditional Mean Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!