Current time:0:00Total duration:7:06

Standard deviation of residuals or root mean square deviation (RMSD)

Video transcript

- [Tutor] So we are interested in studying the relationship between the amount that folks study for a test and their score on a test, where the score is between zero and six and so what we're going to do is go look at the people who took the test, we're going to plot for each person the amount that they studied and their score, so for example, this data point is someone who studied an hour and they got a one on the test and then we're going to fit a regression line and this blue regression line is the actual regression line for these four data points and here is the equation for that regression line. Now there's a couple of things to keep in mind, normally when you're doing this type of analysis, you would do it with far more than four data points, the reason why I kept this to four is because we are actually going to calculate how good a fit this regression line is by hand and typically you would not do it by hand, we have computers for that. Now the way that we're going to measure how good a fit this regression line is to the data has several names, one name is the standard deviation of the residuals, another name is the root mean square deviation, sometimes abbreviated RMSD, sometimes it's called root mean square error, so what we're going to do is is for every point, we're going to calculate the residual and then we're going to square it and then we're gonna add up the sum of those squared residuals, so we're gonna take the sum of the residuals, residuals squared and then we're going to divide that by the number of data points we have minus two and we can talk in future videos or a more advanced statistics class of why you divide by two, but it's related to the idea that what we're calculating here is a statistic and we're trying to estimate a true parameter as best as possible and n minus two actually does the trick for us. But to calculate the root mean square deviation, we would then take a square root of this and some of you might recognize strong parallels between this and how we calculated sample standard deviation early in our statistics career and I encourage you to think about it. But let's actually calculate it by hand, as I mentioned earlier in this video, to see how things actually play out. So to do that, I'm going to ourselves a little table here, so let's say that is our x value in that column, let's make this our y value, let's make this y hat, which is going to be equal to 2.5x minus two and then let's make this the residual squared, which is going to be our y value minus our y hat value, our actual minus our estimate for that given x squared and then we're going to sum them all up, divide by n minus two and take the square root. So first let's do this data point, so that's the point 1,1, 1,1, now what is the estimate from our regression line? Well, for that x value, when x is equal to one, it's gonna be 2.5 times one minus two, so it's gonna be 2.5 times one minus two, which is equal to 0.5 and so our residual squared is going to be one minus 0.5, one minus 0.5 squared, which is equal to, that's gonna be .5 squared, which is gonna be 0.25. Alright, let's do the next data point, we have this one right over here, it is 2,2, now our estimate from the regression line when x equals two is going to be equal to 2.5 times our x value, times two minus two, which is going to be equal to three and so our residual squared is going to be two minus three, two minus three squared, which is negative one squared, which is going to be equal to one, then we can go to this point, so that's the point 2,3, 2,3, now our estimate from our regression line is going to be 2.5 times our x value, times two minus two, which is going to be equal to three and so our residual here is going to be zero and you can see that that point sits on the regression line, so it's going to be three minus three, three minus three squared, which is equal to zero and then last but not least, we have this point right over here, when x is three, our y value, this person studied three hours and they got a six on the test, so y is equal to six, and so our estimate from the regression line, you can see what you would have expected to get, based on the regression line is 2.5 times our x value, times three minus two is equal to 5.5 and so our residual squared is six minus 5.5 squared, it is 5.5 squared, so it's .5 squared, which is 0.25. So now the next step, let me take the sum of all of these squared residuals, so this is, let me just write it this way, do it like this, so the sum of the residuals, residuals squared is equal to, if I just sum all of this up, it's going to be 1.5, 1.5 and then if I divide that by n minus two, so if I divide by n minus two, that's going to be equal to, I have four data points, so I'm gonna divide by four minus two, so I'm gonna divide by two and then I'm gonna wanna take the square root of that, then I'm gonna take the square root of that and so this is going to get us 1.5 over two is the same thing as three-fourths, so it's the square root of three-fourths or the square root of three over two and you could use a calculator to figure what that is, to figure out what that is as a decimal, but this gives us a sense of how good a fit this regression line is, the closer this is to zero, the better the fit of the regression line, the further away from zero, the worst fit and what would be the units for the root mean square deviation? Well, it would be in terms of whatever your units are for your y axis, in this case, it would be the score on the test and that's one of the other values of this calculation, of taking the square root of the sum of the squares of the residuals dividing by n minus two. So big picture, this square root of three over two can be viewed as the approximate size of a typical or average prediction error between these points and what the regression line would have predicted or you could view it as the approximate size of a typical or average residual.