# Can residuals be calculated from N-point moving averages or just the regression line? Also, what is the standard way to determine regression line?

I'm just starting out in statistics and my textbook has given me some confusion. I'm currently working on basic linear regression with bivariate data.

Going by the textbook residuals were determined from N-point moving averages. Also the regression line was taken from the N-point moving averages.

Later on in the chapter however residuals were taken directly from the line of best fit. It is unclear whether this regression line was determined from the original data points or from moving averages.

So to sum it all up, 1) Can residuals be determined from moving averages or are they strictly from the regression line? 2) Can the regression line be determined from the moving averages or only from the original data points?

Having a look through google it looks like the regression line and residuals are taken from the raw data, so I'm unsure why the textbook uses moving averages.

Edit: After looking through the wiki mentioned below I see that the least squares regression line and residuals are derived from the raw data. Not sure what my textbook is going for, maybe using the moving averages instead of the raw data saves time since there are less data points to consider.

• Moving average implies some sort of time series. Was the first case a time series? But, yes, the usual way to get residiuals in OLS regression has nothing to do with moving averages. – Peter Flom Mar 11 '18 at 14:02
• Yes, you are correct. All the work I've done so far involves "something" over a period of time. – IceCreamKimi Mar 11 '18 at 22:44