Howdy! I'm Professor Curtis of Aspire Mountain Academy here with more statistics homework help. Today, we're going to learn how to find the best nonlinear regression model for stock market index values. Here's our problem statement: Listed below are the annual high values, y, of a stock market index for each year beginning with 1990. Let x represent the year, with 1990 coded as x = 1, 1991 coded as x = 2, and so on. Construct a scatterplot and identify the mathematical model that bets fits the given data. Use the best model to predict the annual high value of the stock market index for the year 2007. Is the predicted value close to the actual value of 11,655?
OK, so first we’re asked to construct a scatterplot. To do that, we need to make the actual model itself. Notice here in the problem statement how we’re using coded years. So we have to use coded years to make our model. And the data set that they give us, as you can see here, doesn’t have coded years. So we have to actually make that transformation.
So let’s go ahead and do that first. I click this icon here so that I dump my data into StatCrunch. So here we are in StatCrunch. I’m going to resize this window so we can see everything a little bit better. Excellent! Now we’re done with you. So here in StatCrunch, we can transform these values into coded years. And to do that, I’m going to go up here to Data –> Compute –> Expression. I’m going to build my expression. And then notice here in the problem statement is says that 1990 is coded as x = 1, 1991 is coded as x = 2, so we’re basically, you know, saying that 1989, which is the year before 1990, is going to be x = 0.
So 1989 is our zero year. So that’s what we’re going to need to subtract from each of our year values in order to make coded years. So I select the column for the years and add it to my expression, and then I’m going ot subtract out the zero year (1989), press Okay. You can label the column whatever you want. I typically leave this blank because the default is to go and label the column with the actual expression that was used to transform the data. And I like that; I like knowing what the data is and what the data came from, so I just go ahead and leave that blank. I press Compute! So now I got a new column here with the coded years.
Now I’m ready to make my model. And the way they’re intending for you to work this is you’re going to use this data to make each of the general types of nonlinear models that you’re talking about in this section. That’s like five different models that you have to make! And then you have to compare P-values and adjusted R-squared values. And, you know, if you have to do it that way, then I guess you could do it that way to figure out what the best model is. But I find that it’s much easier if I just use a reference sheet.
So I’m going to show you here a little tool that I developed. This is a reference sheet that you can use for answering these nonlinear regression equation questions that you get on your assignment, and it’s basically two tables. So the first table up here tells us what model we need to make, and the second table tells us, you know, how to manipulate the options in StatCrunch so we can get the numbers we need to put in our answer fields.
So up here at the top, we look to see what the general model is going to be. And you can actually get this reference sheet if you go to the website and you can look to where the blog post is. If you’re watching this on YouTube, you know, just click the link on the description, and it’ll take you to the blog post there on the website, and then down below the viewing window there for the video you can see a link to download for free this actual reference sheet.
Before you use it, if you . . . if you’re not in my class, then you’re probably not going to be using this in a testing situation, in which case, you’re just going to have to work the problem so many times that you understand that, when you see this type of application, it means you make this type of model. And you’re going to have to work the problem so many times that you remember the steps. That’s all I can give you.
Now if you’re in my class, yeah, I’ll let you use this on a test because, I mean, the class isn’t about trying to make you expert model makers. It’s just giving you kind of a brief look at, understanding, cursory look at what’s the process for model making just to give you that general sense of appreciation for how it’s done. You know, I don’t mind you using a reference sheet like this on a test if you’re one of my students. If you’re somebody else’s student, well, you’re probably not going to get it. But at least this will help you work your homework problems, am I right?
So the first thing we do is we look at this first table, and we’re looking for the application here in this area that matches what we’re looking at in the problem statement. So if we go back to our problem statement here, we can see that we’re talking about a stock market index. So I’m going to go back to this reference sheet, and I’m going to look for where it says “stock market index.” And I can look through all the different applications here, and I see it right here — stock market index. So that tells me I need to make a quadratic model. So I don’t have to make all five of these models to know that the quadratic one is the best. That’s really handy. And then of course the general form as you can see is listed here.
Now I can go down to the second table, which is the data transformation table. This tells me how to use StatCrunch to get the answer I need to put in my answer fields. So, again, we’re making the quadratic model. Here’s the general form that we want to use. To get there in StatCrunch, this is the regression option that we want to select. So we want Polynomial, so in StatCrunch, I’m going to go up to Stat –> Regression –> Polynomial (because that’s what the table told me to select).
And here I’m going to select my x- and y-variables. Remember to use the coded years for your X. I take the Y. Poly order here is 2; that’s what the table here is telling me to say. It says in the option window, I want to make sure — there’s nothing I need to do, no change I need to make in the options window, but it says to make sure that Poly order equals 2. And we see that it does. So we got everything we need, so we hit Compute! And out comes our results window.
We’re looking for the scatterplot, so if I hit this little arrow over here in the corner, there’s my scatterplot with my line of best fit. Wow, that looks really great. So now I just look here at my points, and it’s pretty obvious that answer option A is going to be the one that matches. If I want, I can use these options here to blow up the graph, and make sure it looks similar. We’re looking OK. So answer option A is going to be what I select. Nice work!
Now the next part asks for the equation for the best model. We know it’s the quadratic equation. But if you come back here and look, see the general form here? So now I want to pick the answer option in StatCrunch that matches this general form: a-x-squared plus b-x plus c. So as I look at my answer options, that’s going to be answer option A that matches the general form. Now I selected the right one.
To get the answers that I put here in my coefficients, again I go back to my table, and it says in the results window, it says, “a equals x-squared, b equals x, c equals Intercept.” So this a-b-c matches what you see over here in the general form: a, b, and c. And notice that matches the order of the answer fields that I need to put in here in my answer. So it’s going to be a, b, and c. And those numbers, it says, comes out of the results window. This is from the parameters table: x-squared, x, and intercept.
So I come back here to StatCrunch, and notice I got here in my parameters table x-squared, x, and intercept. So these numbers here are what I need to put in my answer fields here. I’m asked to round to three decimal places. So here the first value is going to be this x-squared value here; that’s going to be 1-2-5-point — rounded to three decimal places, that’s going to be 3-5-2. Next, notice we have a negative sign here, so I’m going to have to carry that one through — 44-4-point-9-6-6. And then the last number coming up here — 3-4-2 — excuse me, 3-2-point-9-5. Good job!
And now the last part of the question asks to use the best model to predict the high value for the stock market index in the year 2007. I can make predictions with the model. I can actually, you know, look at this equation, and actually write it out, and punch it out on my calculator, or I can have StatCrunch do it for me. So go back to your options window, scroll down here and see where it says “Prediction of Y.” You put in a value for X, and it will calculate that for you in the regression equation.
But remember — you used coded years for your model. This is why I hate coded years, because in order to use the model, you have to put in a coded year. So we can’t just put in 2007. We have to change that to a coded year. And we do that by subtracting out the zero year. So here in my calculator, I take 2007, subtract out my zero year (which was 1989), and I get 18. So 18 is the number I want to stick in here. I come down here and hit Compute! And then scroll down here. And down here at the very bottom, I see my predicted value 36000, which is a long ways away from 11,655. So that’s much higher than that. So, no, it’s not close at all to the actual value. We want either A or B. A says “dramatically greater.” B says “dramatically lower.” A is going to be what we want. And I stick the value that we get in here rounded to the nearest whole number. Nice work!
And that's how we do it at Aspire Mountain Academy. Feel free to leave your comments below and let us know how good a job we did or how we can improve. And if your stats teacher is just boring or doesn't want to help you learn stats, then go to aspiremountainacademy.com, where you can learn more about accessing our lecture videos or provide feedback on what you’d like to see. Thanks for watching! We’ll see you in the next video!
Leave a Reply.
Frustrated with a particular MyStatLab/MyMathLab homework problem? No worries! I'm Professor Curtis, and I'm here to help.