フィルターのクリア

Error when increasing size of dependent variable linear regression

1 回表示 (過去 30 日間)
Wietze Zijpp
Wietze Zijpp 2022 年 4 月 6 日
コメント済み: Wietze Zijpp 2022 年 4 月 6 日
Suppose I have the following forloop which estimates parameters of a linear model
count = 0;
nmonth = 5;
for j = 1:dimensions(2) % number of stocks 1 , 2 and 3
for i = 1:nmonth
mdl = fitlm(X((30*i-30+1):i*30,:),Y((30*i-30+1):i*30,j)); % regression
% for one month of the regressors X on Y for stock 1.
count = count+1;
montherrors(:,(count)) = mdl.Residuals(:,1); % daily errors for
errors = table2array(montherrors); % convert to array so I can perform
% calculations
stdev = std(errors,1);
idioallstocks = stdev * sqrt(ndays);
end
end
Warning: Regression design matrix is rank deficient to within machine precision.
Now when dimensions(2) is for example 50 it works perfectly fine. But when dimensions(2) is for example 100 I get the error Warning: Regression design matrix is rank deficient to within machine precision and I do not know why.
  2 件のコメント
Torsten
Torsten 2022 年 4 月 6 日
Maybe there are NaN / Inf values in the Y-matrix for j > 50 ?
Wietze Zijpp
Wietze Zijpp 2022 年 4 月 6 日
Thank you for this response !

サインインしてコメントする。

回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by