Least squares regression

  • #1

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.7 KB · Views: 339

Answers and Replies

  • #2
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722

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.
 
  • #3
so if i do this should i get
\hat{y} =Y(bar)?
 
  • #4
y(hat)(Xbar) = Y(bar)? still hopeless at notation :(
 
  • #5
or should i get,
Y(bar) = a(hat) +b(hat)X(bar)
 
  • #6
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
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
[tex] \bar{Y} = \hat{a} + \hat{b} \bar{x} [/tex]
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
[tex] \overline{Y} = \hat{a} + \hat{b} \overline{x} [/tex]

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:
  • #8
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
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.
 
  • #9
ahhh... so after doing some algebra i get yhat(Xbar) = Y(bar)
 
  • #10
let me try in notation [tex] \hat{y}(\bar{x})=\bar{Y} [/tex]
 
  • #11
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
let me try in notation [tex] \hat{y}(\bar{x})=\bar{Y} [/tex]

Yes, exactly.
 

Related Threads on Least squares regression

  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
5
Views
1K
Replies
3
Views
1K
Replies
0
Views
1K
Replies
5
Views
2K
  • Last Post
Replies
7
Views
975
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
8
Views
2K
Top