필터 지우기
필터 지우기

Multiple Linear Regression using "REGRESS"

조회 수: 8 (최근 30일)
Priya
Priya 2013년 10월 5일
댓글: dpb 2013년 10월 15일
Hello
I am using regress function for multiple linear regression analysis. Once I obtain the values of coefficients, I substitute in the equtation to get the new / predicted values of y.
Then I make the scatterplot of y_original and y_predicted. How can I show the regression line for equation y = ax1 + bx2 + cx3 + d on this scatter plot ? What code should I write for this problem ?
Secondly, How can I find the random error for this multiple linear regression relationship ?
  댓글 수: 1
Priya
Priya 2013년 10월 13일
Thanks , this means I cannot plot a multidimensional plot, which can show me the relationship of all three variables (x1,x2,x3) with y ????
Secondly, every regression equation has some random error associated with it. How can we find that random error and what can we conclude out of it ? How shall we interpret that random error ?
Thanks

댓글을 달려면 로그인하십시오.

답변 (2개)

dpb
dpb 2013년 10월 5일
s=sprintf('y = %.2f*ax1 + %.2f*x2 + %.2f*x3 + %.2f', b); text(x,y,s)
b is the coefficient matrix from regress; x, y are the coordinates of location where you wish to write the equation in the units of the x- and y-axes used for scatter
  댓글 수: 7
Priya
Priya 2013년 10월 13일
Thanks , this means I cannot plot a multidimensional plot, which can show me the relationship of all three variables (x1,x2,x3) with y ????
Secondly, every regression equation has some random error associated with it. How can we find that random error and what can we conclude out of it ? How shall we interpret that random error ?
Thanks
Priya
Priya 2013년 10월 15일
@ Image Analyst :
Thanks. Now after applying regress, I get the coefficients a,b,c,d for the following equation:
y_predicted = a.x1 + b.x2 +c.x3 + d
When I substitute these coefficients a,b,c,d along with x1 dataset, x2 dataset, x3 dataset respectively into the equation,I will get the y_predicted dataset. For making a scatter plot between y_original dataset and y_predicted dataset, I use use the following command:
plot(y_predicted,y_original,'o')
Question is:
How can I show the line representing the above equation ( y_predicted = a.x1 + b.x2 +c.x3 + d ) on this scatter plot ?

댓글을 달려면 로그인하십시오.


Priya
Priya 2013년 10월 13일
Thanks , this means I cannot plot a multidimensional plot, which can show me the relationship of all three variables (x1,x2,x3) with y ????
Secondly, every regression equation has some random error associated with it. How can we find that random error and what can we conclude out of it ? How shall we interpret that random error ?
Thanks
  댓글 수: 5
Priya
Priya 2013년 10월 15일
No, in this case I have only two variables : y_predicted which is obtained by substituting the values in the above regression equation and y_original (input y dataset).
I can plot the scatter plot, but don't know how to show the line on the plot.
Is it possible to show the line represented b this equation on the scatter plot.
dpb
dpb 2013년 10월 15일
편집: dpb 2013년 10월 15일
Oh, misinterpreted the question or the intended use of "line" -- that there's no line on the plot by your above command is because that's what you told it to do...
plot(y_predicted,y_original,'o')
says use the 'o' marker; you didn't specify a line style so Matlab obeyed and didn't, either. Use
plot(y_predicted,y_original,'o-')
or alternate linestyle of choice.
doc plot % documents above behavior and marker/linestyle choices

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by