Column of ONES in multiple regression
古いコメントを表示
What is the meaning of adding a column of ones in the multiple regression? Thanks a lot, G.
採用された回答
その他の回答 (2 件)
Image Analyst
2013 年 1 月 30 日
編集済み: Image Analyst
2013 年 1 月 30 日
That means that your equation (model) will have a constant offset, like the "a3" in y = a1 * x1 + a2 * x2 + a3. In the manual method of making the arrays for least squares regression, you make a "tall" array of your measured (observed) values for x1 and x2
x1(1), x2(1), 1
x1(2), x2(2), 1
x1(3), x2(3), 1
x1(4), x2(4), 1
...
x1(n), x2(n), 1
Then you do the matrix math and you get estimates for all the "a" coefficients of your model.
2 件のコメント
Image Analyst
2013 年 2 月 2 日
No there wouldn't. You'd have an equation like this:
y = a1 * x1 + a2 * x2
instead of this:
y = a1 * x1 + a2 * x2 + a3
If you want, in the first equation you can say that the offset is zero but I don't know how that helps. I hope you can see that the second equation is different than the first equation. The second equation will give you an offset. If, for x = [0 1 2 3 4] you had y = [10 11 12 13 14], then you'd have y=x+10. If you didn't have the 1's you'd get an equation like y=12*x or something - totally different.
Oleg Komarov
2013 年 1 月 30 日
0 投票
In regress(), you need to add a column of ones to allow for an intercept in the regression. Otherwise, you constrain the fit to go through the origin.
4 件のコメント
Oleg Komarov
2013 年 1 月 30 日
No. The coefficient of the intercept is determined by least squares method and not set to 0 ex-ante.
Nuchto
2013 年 2 月 2 日
Shashank Prasanna
2013 年 2 月 2 日
編集済み: Shashank Prasanna
2013 年 2 月 2 日
It means the constant acts as an intercept term I found a random image which might make things clearer to you:
the 10 is the intercept or in your case the value of the coefficient of ONE. Without the 10, the line would pass through the origin.
If you look at my example below in my plot, it becomes clearer how the ONEs contribute to the intercept 'x3'
カテゴリ
ヘルプ センター および File Exchange で Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!