CHAPTER 06.04: NONLINEAR REGRESSION: Polynomial Model: Example: Part 1 of 2
In this segment, we're going to take an example of a polynomial regression model. So we have a polynomial regression model, and we're going to take an example to see that how do we do polynomial regression to data. So let's suppose somebody gives us alpha versus temperature data, so somebody is giving us alpha and temperature, so alpha is the thermal expansion coefficient. The units of that are, let's suppose, micro- inch per inch per degree Fahrenheit, and the temperature, let's suppose, is given in degrees Fahrenheit. So somebody is giving us temperature . . . alpha versus temperature data, and would like us to regress it to, let's suppose a second-order polynomial. So let me write down the data first, so this is, of a typical steel, the temperatures are given at 80, 40, -40, -120, -200, and -280. So we're given six different temperatures, and we are given six different values of alpha, and as you can see that as you decrease the temperature, so does the value of alpha, which means that you get less expansion per unit temperature as you go through cryogenic temperatures. So here we have alpha versus temperature data given to us, and let's suppose somebody tells us, hey, go ahead and regress it to a second-order polynomial. So I want you to regress the alpha versus temperature data which is given to you to a second-order polynomial, which means that you have to find out what these three coefficients are, a0, a1, and a2. So if you are able to find out what these three constants of the second-order polynomial model are, you have been able to do you regression. So based on that, let's suppose somebody then at the end says that, hey, okay, once you find out what the constants of this regression model are, can you give me what the value of alpha is at 70 degrees Fahrenheit? Can you predict what the value of the thermal expansion coefficient will be at 70 degrees Fahrenheit? Now, from a previous segment, we already know what the formula for the polynomial regression model is. I'm going to write it down here for this particular case, for the second-order polynomial case, and that looks like this. So you'll have these constants, a0, a1, and a2, can be found out if we are able to solve these set of equations. So you have a0, a1, a2, they are the three constants of the polynomial model. And you have n, times summation, Ti, summation, Ti squared, you've got summation, Ti here, summation of Ti squared here, summation of Ti cubed here, then summation of Ti squared here, summation, Ti cubed here, and summation of Ti 4 here. So those are the summations which you need, where T is the temperature, those are the summations which you need to be able to fill in this coefficient matrix, and then the right-hand side is nothing but summation of alpha-is, summation of alpha-i Tis, and summation of alpha-i Ti squares. All these summations go from 1 to n, where n is the number of data points. I've not put the summations in there just so that the coefficient matrix does not look crowded. There's no other reason for me not to show those summations on all of the summations which you see in these three simultaneous linear equations. So the bottom line is to be able to fill in the coefficient matrix, to be able to fill in the right-hand side vector, and once you know what the right-hand side vector is, what the coefficient matrix is, you should be able to find out what a0, a1, and a2 are, the three coefficients, or the 3 constants of the regression model, that's all there is to it. So we already know that n is equal to 6, so that will take care of the first row, first column of this. Now, summation of Ti, I'm going to show you some of them, and other ones which you can do at home. So summation of Tis is just adding all the Ti values, it's 80, 40, minus 40, minus 120, minus 200, minus 280, the reason why you have a minus sign is because the temperatures are negative, not that I'm subtracting anything, so I'm adding all the Ti values, and those turn out to be -520. So that's the summation of all the Ti values. So I'm going to show you one more, let's suppose, I want to find out the summation of all the Ti squared values, which will be simply 80 squared, plus 40 squared, plus -40 squared, plus -120 squared, plus -200 squared, plus -280 squared, and this value here turns out to be 1.424 times 10 to the power 5. So that's what you get by summing all the Ti squared values. So similarly you can find out what the summation of Ti cubed is, Ti to the power 4 is, because that's what you need. You need Ti squared, so if you look at the coefficient matrix again here, you need summation of Ti, summation of Ti squared, Ti cubed, and Ti 4. So I'm going to just write those down here. So you get summation of Ti cubed, that is adding all the . . . taking cube of all the temperatures, and adding them up, and you get -3.117 times 10 to the power 7, the reason why you're getting a minus sign is because there are negative temperatures also in the data. And then summation of Ti raised to the power 4, again, this will be a positive value, because you are taking an even power of temperatures, and that turns out to be 8.000 times 10 to the power 9. So these are all the summations which you need for the coefficient matrix, let's go ahead and see that how we will calculate the summations which we need for the right-hand side vector.