How to interpret an answer given by the "regress" function

2 ビュー (過去 30 日間)
Bogdan
Bogdan 2013 年 12 月 29 日
コメント済み: Bogdan 2013 年 12 月 29 日
Hello! :)
I am trying to link two sets of data through regression. Multiple linear regression, to be more precise. The general regression equation is this:
y=a0+a1*x1+a2*x2+a3*x3+a4*x4 (1)
So far so good. I have the y matrix, as a 60x1 double and the x matrix, as a 60x4 double. I use the following command:
b=regress(y,x)
And the answer that I get is this:
b=0.0073, 0.0074, 0.0071, 0.107
I have two questions:
  1. The regression function (1) has 5 coefficients; but here I get only 4. Where am I mistaking?
  2. Which one of these four coefficients stored in the b variable goes to which of the ax coefficients from the function (1)?
Thank you!

採用された回答

Wayne King
Wayne King 2013 年 12 月 29 日
編集済み: Wayne King 2013 年 12 月 29 日
Your design matrix should be 60x5, not 60x4, you need a column of ones for the constant term, a0.
So start by doing the following:
x = ones(60,5);
then fill columns 2 to 5 with your x1, x2, x3, and x4 predictors.
  1 件のコメント
Bogdan
Bogdan 2013 年 12 月 29 日
Yeah, that was the missing link, It worked and everything makes sense. Thank you very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by