From: Wayne King on
"Oscar LAI" <oscar_lai_s_k(a)yahoo.com.hk> wrote in message <hk7378$li9$1(a)fred.mathworks.com>...
> Hi everyone,
>
> I had a problem using the function garchset when running an OLS regression. My code is:
>
> A = xlsread('public.xls');
> spec = garchset('P',0,'Q',0,'C',0,...
> 'Regress',1.2,...
> 'K',0.00015,...
> 'Display','off')
> strm = RandStream('mt19937ar','Seed',2269);
> RandStream.setDefaultStream(strm);
> [e,s,y] = garchsim(spec,1225,14,[],A); % Optional Inputs: NumSamples, NumPaths, State, X, Tolerance, PreInnovations, PreSigmas, PreSeries
> [coeff,errors] = garchfit(spec,y,A);
> garchdisp(coeff,errors)
>
>
> an error msg comes up like:
> ??? Error using ==> garchsim at 295
> Number of 'Regress' coefficients unequal to number of regressors in 'X'.
>
>
> the size of matrix A is 1225, 14. so there should be 14 regressors. How will I be able to solve the problem? please help. Thx a lot!

Hi Oscar, I think your problem is in your specification of the 'Regress' parameter as 1.2 in garchset().

According to the help, that should be a vector of conditional mean regression coefficients. If you run

regress = garchget(spec,'Regress');

on your garchset() output, you'll see you obtain 1.2 (not surprisingly because you set it that way), but that should equal the size of your exogenous data matrix, A, in the 2nd dimension (number of columns). Each column of that matrix should be an explanatory variable in the conditional mean model. So your specifications in garchset(), should match what you're doing in garchsim().

Wayne