so i need to figure out how the heck to find residuals
Please make it easier for yourself and others to understand this question by describing the context. In this case I believe the context is elementary statistics / data analysis. Have you taken the time to look up the word "residual?"
okey, i have a scatter plot, (it says algebra but my friends say its calc) and the next problem say to Find the residuals
i ment stat, lol not calc
You'll need that scatter plot. But beyond that, you'll also need to find the regression line for that data. Are you familiar with these terms and with the techniques necessary to find regression lines for sets of data? Again, have you looked up the word "residue" as it applies to statistics? if not, please do so.
i have been reading about that and yes i have read the residuals for stat, but i was literally dropped in a course that i havent had any reviewing or anything on in four years
Looks as though you'll need to do a systematic review on your own of material you learned four years ago and now need to understand. Given a set of data and the related regression line, how would you go about calculating a "residue" for a given x-value?
The residual is the difference in between the actual observed value, and the regression line value. If \(r_i\) is the residual, and \(y_i\) is the observed value and \(\hat{y_i}\) is the regression line estimate, then: \(r_i = y_i - \hat{y_i}\) Visually, this is: |dw:1402372591427:dw|
Now recall the general equation of a line, \(y = b + mx\). We will use the notation \(\hat{y}\) to denote the regression line equation. Statisticians love Greek letters, so often they will write instead: \(\hat{y}=\hat{\beta_0} + \hat{\beta_1} x\) Now, before attacking residuals, first we talk about errors. Errors are like residuals, except this occurs at the population level, rather than at the sample level. So, you can define each point, theoretically, as \(y_i = \beta_0 +\beta_1x_i + \varepsilon_i\), where the \(\varepsilon_i\) is the error term. So basically, your point will following the "line" in the first two terms, but it deviates from the line by this error term (which you can think of like a residual at the population level). Now sure how much stats you have done, but the goal of the regression line is to minimize all the errors for every point. A common procedure to do this is call Least Squares Estimation, which minimizes the squared distance of the sum of all the errors. (We take the square since we want to ignore the sign of the distance... we could use absolute value, but the absolute value is not differentiable everywhere, which is a desirable property when doing Least Squares Estimation). Obviously, we don't know \(\beta_0 \) nor \(\beta_1\), so we estimate them using a sample of say \(n\) data point, and estimation of these is using Least Squares. Say there are \(n\) observations, or points n your plot, then the goal is to minimize the function \[\large S=\sum_{i=1}^n\varepsilon_i^2\] (this is the sum of all the squares errors). Note that \(y_i = \beta_0 +\beta_1 x_i +\varepsilon_i \implies \varepsilon_i = y_i -\beta_0-\beta_1 x_i\). \[\large S =\sum_{i=1}^n(y_i-\beta_0-\beta_1 x_i))^2 \] This is the function to minimize. From calculus, you can find the max/mins by taking the first and second derivatives (1st and 2nd derivative tests more specifically). Since we don't know the intercept or the slope of the regression line, we find the derivative with respect to these values so that we can estimate them and find our regression line. 1st derivative test: Find derivative and set it equal to 0: \[ \large\frac{\partial S}{\partial \beta_0}=\frac{\partial }{\partial \beta_0}\sum_{i=1}^n(y_i-\beta_0 -\beta_1 x_i)^2\\ \large =2\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)(-1)=0\\ \implies \large \sum_{i=1}^n(y_i-\beta_0-\beta_1 x_i)=0\\ \implies \large \sum_{i=1}^n y_i-\sum_{i=1}^n\beta_0-\sum_{i=1}^n\beta_1x_i=0\\ \implies \large n\bar{y} -n\beta_0-\beta_1 n\bar{x}=0\\ \implies \large \hat{\beta_0}=\bar{y}-\hat{\beta_1}\bar{x}\] The little "hats" are placed at the end by convenience to indicate that we have estimated these values. \[ \large\frac{\partial S}{\partial \beta_1}=\frac{\partial }{\partial \beta_1}\sum_{i=1}^n(y_i-\beta_0 -\beta_1 x_i)^2\\ \large =2\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)(-x_i)=0\\ \implies \large \sum_{i=1}^ny_ix_i-\sum_{i=1}^n\beta_0 x_i-\sum_{i=1}^n\beta_1x_i^2=0\\ \implies \large \sum_{i=1}^ny_ix_i-\beta_0 n\bar{x} -\beta_1\sum_{i=1}^n x_i^2 = 0\\ \implies \large \hat{\beta_1}=\frac{\sum_{i=1}^ny_ix_i-\hat{\beta_0} n\bar{x}}{\sum_{i=1}^n x_i^2}\\ \implies ... \implies \large \hat{\beta_1}=\frac{\sum_{i=1}^n(x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=1}^n(x_i-\bar{x})^2}\] For the 2nd derivatives test, you just find the appropriate 2nd partial derivatives and use the 2nd partial derivative test for multivariable functions (i.e check it's negative definite). ------------------------ So at the end of the day, the estimated errors are the residuals: \[\boxed{\large \hat{\varepsilon_i}=r_i =\ y_i -\hat{y_i}=y_i -(\hat{\beta_0}+\hat{\beta_1}x_i) \\ \text{where }\\ \large \hat{\beta_0} =\bar{y}-\hat{\beta_1}\bar{x}\\ \large \hat{\beta_1}=\Large \frac{\sum_{i=1}^n(x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=1}^n(x_i-\bar{x})^2}}\]
Join our real-time social learning platform and learn together with your friends!