Simple econometric regression
古いコメントを表示
Hi,
I would like to perform a simple econometric regression using Matlab, but I have been struggling to do it for a few days now. Quite simply, I have a set of data for both X and Y. I would like to perform a regression of the following form: Y= BetaZero + Beta*X + ErrorTerm. Could anyone please tell me what is the right function to do so? I've been trying to accomplish that by using regress(), but I realised that it does not return the value of the constant term (aka Beta zero or alpha). Thank you very much for your help.
採用された回答
その他の回答 (2 件)
Fangjun Jiang
2011 年 8 月 1 日
0 投票
You have the right function. Just try it with three return variables.
[B,BINT,R] = REGRESS(Y,X) returns a vector R of residuals.
Read the full text of help regress
3 件のコメント
Marcin Kuc
2011 年 8 月 1 日
Oleg Komarov
2011 年 8 月 1 日
You have to add a column of ones for the constant. As already suggested read the documentation.
Marcin Kuc
2011 年 8 月 1 日
Fangjun Jiang
2011 年 8 月 2 日
To use regress();
x=(1:100)';
y=10+2*x+rand(100,1);
[B,BINT,ErrorTerm]=regress(y,[ones(size(x)),x]);
BetaZero=B(1)
Beta=B(2)
BetaZero =
10.6381
Beta =
1.9976
カテゴリ
ヘルプ センター および File Exchange で Econometrics Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!