Lab 6 - Due by the end of Module 4
Why?: In Lab 6 we are using RStudio to get a quick lesson on how to use Linear Regression. We will use the function “lm” which was used previously in Lab 3.
Complete Lab Exercise 6 in the EMC Lab Guide ONLY THROUGH
STEP 6 (skip Step 7). For credit, you
only need to answer questions that appear below (at the bottom of this
document).
Note:
· You will want to open the script file “ols.txt” from Get Stuff to assist you in the lab steps.
· As always, you will need to set your own Working Directory.
· Note in Step 3: Pay attention to the output descriptions in the Lab Guide.
· Note in Step 4: Again pay attention to the output descriptions in the Lab Guide. Quite important here is that the “Q-Q Plot” needs to look linear (along the xy line).
· Note in Step 6 that you are SQUARING the variable x2, and so the “picture” or scatterplot of y vs. x2 will no longer look linear. That is how you are “introducing a slight non-linearity”. You are doing this to show that your diagnostic values (like F, p, R-squared) should get WORSE. Your plot(x2,y2) should look slightly non-linear. Depending on how your random data was generated, it is possible your values will not get worse. Don’t worry about that.
· Note in Step 7: Skip this step.
Post all answers/screen
shots to your class Google Sites page under “LAB06”.
Step 3, (2):
Show a screen shot (no IP
needed) and discuss the Summary(d1) results.
In particular, answer the following:
What is the coefficient of
x1? Is it significant?
Is your linear model
doing better than just guessing the mean value of y for the prediction
line? Why or why not?
Step 4, (3):
Show a screen shot of
your fitted regression line against the data set.
Step 5, (2):
How well did your
line fit the data? What is your
“goodness of fit”? What is your
R-squared? [Note: These are essentially the same three
questions]