GARCH(1,1): Matrix from standardized residuals do not have exact 1’s on the diagonal
Hello,
I am trying to estimate a GARCH(1,1), get the standardized residuals and form a matrix from them. My R_bar does not have exact 1’s on the diagonal even though they are very close to 1 (for example, 0.9983, 0.9997, 1.023…). Specifically I trying to do this:
data = parquetread(‘/datacommons/dfe/cov/close_to_close_2010-2014.parquet’);
returns = data{:, 2:end};
numAssets = size(returns, 2);
%returns look like this:
%header stock_1 stock_2 …
%date1 return_1 of stock 1 return_1 of stock 2
%date2 return_2 of stock 1 return_2 of stock 2
%…
%returns are not demeaned
mdl = cell(numAssets, 1);
estMdl = cell(numAssets, 1);
condVar = cell(numAssets, 1);
standardizedResiduals = cell(numAssets, 1);
residuals = cell(numAssets, 1);
for i = 1:numAssets
mdl{i} = garch(‘Offset’, NaN, ‘GARCHLags’, 1, ‘ARCHLags’, 1); %I did not demean the returns so I let the model estimate the "offset" parameter
estMdl{i} = estimate(mdl{i}, returns(:, i), ‘Display’, ‘off’);
condVar{i} = infer(estMdl{i}, returns(:, i));
residuals{i} = (returns(:, i) – estMdl{i}.Offset) ;
standardizedResiduals{i} = (returns(:, i) – estMdl{i}.Offset) ./ sqrt(condVar{i}); %Step4 from: https://www.mathworks.com/help/econ/infer-conditional-variances.html
end
% concat into a matrix of TxN where T is the number of time periods and N
% is the number of stocks
standardizedResidualsMat = zeros(T, numAssets);
for i = 1:numAssets
standardizedResidualsMat(:, i) = standardizedResiduals{i};
end
R_bar = zeros(numAssets, numAssets);
for t = 1:T
R_bar = R_bar + (standardizedResidualsMat(t, :)’ * standardizedResidualsMat(t, :));
end
R_bar = R_bar / T;Hello,
I am trying to estimate a GARCH(1,1), get the standardized residuals and form a matrix from them. My R_bar does not have exact 1’s on the diagonal even though they are very close to 1 (for example, 0.9983, 0.9997, 1.023…). Specifically I trying to do this:
data = parquetread(‘/datacommons/dfe/cov/close_to_close_2010-2014.parquet’);
returns = data{:, 2:end};
numAssets = size(returns, 2);
%returns look like this:
%header stock_1 stock_2 …
%date1 return_1 of stock 1 return_1 of stock 2
%date2 return_2 of stock 1 return_2 of stock 2
%…
%returns are not demeaned
mdl = cell(numAssets, 1);
estMdl = cell(numAssets, 1);
condVar = cell(numAssets, 1);
standardizedResiduals = cell(numAssets, 1);
residuals = cell(numAssets, 1);
for i = 1:numAssets
mdl{i} = garch(‘Offset’, NaN, ‘GARCHLags’, 1, ‘ARCHLags’, 1); %I did not demean the returns so I let the model estimate the "offset" parameter
estMdl{i} = estimate(mdl{i}, returns(:, i), ‘Display’, ‘off’);
condVar{i} = infer(estMdl{i}, returns(:, i));
residuals{i} = (returns(:, i) – estMdl{i}.Offset) ;
standardizedResiduals{i} = (returns(:, i) – estMdl{i}.Offset) ./ sqrt(condVar{i}); %Step4 from: https://www.mathworks.com/help/econ/infer-conditional-variances.html
end
% concat into a matrix of TxN where T is the number of time periods and N
% is the number of stocks
standardizedResidualsMat = zeros(T, numAssets);
for i = 1:numAssets
standardizedResidualsMat(:, i) = standardizedResiduals{i};
end
R_bar = zeros(numAssets, numAssets);
for t = 1:T
R_bar = R_bar + (standardizedResidualsMat(t, :)’ * standardizedResidualsMat(t, :));
end
R_bar = R_bar / T; Hello,
I am trying to estimate a GARCH(1,1), get the standardized residuals and form a matrix from them. My R_bar does not have exact 1’s on the diagonal even though they are very close to 1 (for example, 0.9983, 0.9997, 1.023…). Specifically I trying to do this:
data = parquetread(‘/datacommons/dfe/cov/close_to_close_2010-2014.parquet’);
returns = data{:, 2:end};
numAssets = size(returns, 2);
%returns look like this:
%header stock_1 stock_2 …
%date1 return_1 of stock 1 return_1 of stock 2
%date2 return_2 of stock 1 return_2 of stock 2
%…
%returns are not demeaned
mdl = cell(numAssets, 1);
estMdl = cell(numAssets, 1);
condVar = cell(numAssets, 1);
standardizedResiduals = cell(numAssets, 1);
residuals = cell(numAssets, 1);
for i = 1:numAssets
mdl{i} = garch(‘Offset’, NaN, ‘GARCHLags’, 1, ‘ARCHLags’, 1); %I did not demean the returns so I let the model estimate the "offset" parameter
estMdl{i} = estimate(mdl{i}, returns(:, i), ‘Display’, ‘off’);
condVar{i} = infer(estMdl{i}, returns(:, i));
residuals{i} = (returns(:, i) – estMdl{i}.Offset) ;
standardizedResiduals{i} = (returns(:, i) – estMdl{i}.Offset) ./ sqrt(condVar{i}); %Step4 from: https://www.mathworks.com/help/econ/infer-conditional-variances.html
end
% concat into a matrix of TxN where T is the number of time periods and N
% is the number of stocks
standardizedResidualsMat = zeros(T, numAssets);
for i = 1:numAssets
standardizedResidualsMat(:, i) = standardizedResiduals{i};
end
R_bar = zeros(numAssets, numAssets);
for t = 1:T
R_bar = R_bar + (standardizedResidualsMat(t, :)’ * standardizedResidualsMat(t, :));
end
R_bar = R_bar / T; garch, econometrics toolbox MATLAB Answers — New Questions