How Do You Calculate Predicted Values in Least Squares Regression?

stats_student
Messages
41
Reaction score
0

Homework Statement


note a linear regression model with the response variable Y=(Y1..Yn) on a predictor variable X=(X1..Xn). the least squares estimates of the intercept and slope a(hat) and B(hat) are the values that minimize the function: (see attached image)

and the problem reads on further -

further predicted values equal y(hat)(x)=a(hat)+b(hat)x (note y(hat) is meant to be read as a function of x)

i have been asked to find y(hat)(Xbar), where X(bar) is the average of the Xi's. (note y(hat) is meant to be read as a function of Xbar).

i'm not sure where to start with this question. advice as to whether I'm on the right track is all i need for now.

so i was thinking that i could use the fact that

a(hat) = Y(bar)-B(hat)X(bar) and B(hat) = (sum) (Xi-X(bar))(Yi-Y(bar)) /(sum) (Xi-X(bar))^2

but I'm not exactly sure how to solve for y(hat)X(bar) -(yhat as a function of Xbar)

should i be trying to get a equation with only a(hat) , b(hat) , and Xbar?Thanks for the help - apologies for poor notation
 

Attachments

  • Snapshot.jpg
    Snapshot.jpg
    6.2 KB · Views: 420
Physics news on Phys.org
stats_student said:

Homework Statement


note a linear regression model with the response variable Y=(Y1..Yn) on a predictor variable X=(X1..Xn). the least squares estimates of the intercept and slope a(hat) and B(hat) are the values that minimize the function: (see attached image)

and the problem reads on further -

further predicted values equal y(hat)(x)=a(hat)+b(hat)x (note y(hat) is meant to be read as a function of x)

i have been asked to find y(hat)(Xbar), where X(bar) is the average of the Xi's. (note y(hat) is meant to be read as a function of Xbar).

i'm not sure where to start with this question. advice as to whether I'm on the right track is all i need for now.

so i was thinking that i could use the fact that

a(hat) = Y(bar)-B(hat)X(bar) and B(hat) = (sum) (Xi-X(bar))(Yi-Y(bar)) /(sum) (Xi-X(bar))^2

but I'm not exactly sure how to solve for y(hat)X(bar) -(yhat as a function of Xbar)

should i be trying to get a equation with only a(hat) , b(hat) , and Xbar?Thanks for the help - apologies for poor notation

If you have set up and solved the least-squares equations (so that you know the parameters ##\hat{a}, \hat{b}## in terms of the ##\{x_i, y_i\}##, you can just substitute ##x = \bar{x}## into the equation ##\hat{y} = \hat{a} + \hat{b} x##, and carry out algebraic simplification.

BTW: it is easy to employ good notation---just use LaTeX. To see how I did it, just right-click on an expression and to to the menu item to 'display math as tex commands'. This site has a brief LaTeX tutorial on the use of LaTeX, but I cannot say exactly where/how to find it; others may know.
 
so if i do this should i get
\hat{y} =Y(bar)?
 
y(hat)(Xbar) = Y(bar)? still hopeless at notation :(
 
or should i get,
Y(bar) = a(hat) +b(hat)X(bar)
 
stats_student said:
or should i get,
Y(bar) = a(hat) +b(hat)X(bar)

You need to tell the system "LateX starts here" ... and "Latex ends here", with your mathematical expressions in between.

For displayed equations use

[t ex] ...your expressions ... [/t ex]

with no spaces between the 't' and the 'ex', and not in a red-colored font (which I used just for emphasis). Doing that on your expression above gives
\bar{Y} = \hat{a} + \hat{b} \bar{x}
Note that we write \bar{Y}, not Y(bar), and we write \hat{a}, not a(hat). Some people prefer the look of \overline{...} instead of \bar{...}, and using that instead gives
\overline{Y} = \hat{a} + \hat{b} \overline{x}

For in-line equations or expressions, use

# # ... expression... # #

with no space between the two #s at the start and at the end, and not in a red font. Doing that with your expression above gives ##\bar{Y} = \hat{a} + \hat{b} \bar{x}##, as wanted.

Anyway, you cannot just wrote that ##\bar{Y} = \hat{a} + \hat{b} \bar{x}##, because the right-hand-side is ##Y_{\text{fitted}}(\bar{x})##, but how do you know that ##Y_{\text{fitted}}(\bar{x}) = \bar{Y}##? Can you even be sure it is true?
 
Last edited:
should i get y(Xbar) = a(hat)+b(hat)X(bar)
 
stats_student said:
should i get y(Xbar) = a(hat)+b(hat)X(bar)

Yes, but that is not the end of the story. You ought to be able to simplify it a lot, using either the explicit expressions for ##\hat{a}## and ##\hat{b}##, or by exploiting the fact that ##\hat{a}, \hat{b}## satisfy some particular equations obtained by minimization of the total squared error.
 
ahhh... so after doing some algebra i get yhat(Xbar) = Y(bar)
 
  • #10
let me try in notation \hat{y}(\bar{x})=\bar{Y}
 
  • #11
stats_student said:
let me try in notation \hat{y}(\bar{x})=\bar{Y}

Yes, exactly.
 
Back
Top