lab06, homework
Homework
Polynomials
* Homework 7, Due
/*------------------------------------------------------------------
| Draper and Smith report radial growth of ice crystals in a room |
| kept at -5 degrees C. The exposure time X and radial diameter of |
| ice crystals Y are recorded for several replications of the |
| experiment. |
-------------------------------------------------------------------
Questions
-------------------------------------------------------------------
| 1. An attempt is made to fit a degree 21 polynomial below. What |
| happened? Why do you think this happened? Why was a degree |
| 21 polynomial investigated? |
| 2. Theoretically, it should be possible to fit a degree 21 |
| polynomial. Put TIME in a class statement in GLM and from |
| the output, find the (corrected) regression sum of squares |
| that WOULD HAVE resulted had our attempt to fit a degree 21 |
| polynomial been successful. |
| 3. Plot the data using the code shown below. |
| Why is the plot instruction repeated 3 times |
| with an overlay option? What does the i=R option in the |
| symbol statement control? (use the HELP menu --> GRAPHICS |
| to find out). What is your guess as to the need for a |
| higher than linear model? |
| 4. Run regressions to determine the equations for the three |
| curves in your plot. (this should match the log window |
| message from gplot) |
| 5. Using question 2 and 4 results, test for lack of fit of your |
| linear model (versus a degree 21 model). Also look at the |
| cubic you fit in problem 4 and test to see if its quadratic |
| and cubic terms can be omitted (this is a pseudo lack of fit |
| test assuming no higher than degree 3 is needed). |
| 6. Put in a variable LOF which is just a copy of the TIME |
| variable. Now submit this code: |
| PROC GLM; CLASS LOF; MODEL Length = Time LOF/SS1; |
| Explain how the output relates to some things we've done |
| above. |
| IF the linear model lack of fit had been significant, we might|
| have tried a quadratic. Show how to modify the above code to |
| check lack of fit of a quadratic model (even though it might |
| not make sense to fit a quadratic to this particular data) |
| Suppose someone fits the quadratic, notes that it has a |
| maximum and proceeds to state that beyond that point the |
| variable Y= length will decrease. Criticize his comments. |
| 7. (optional - not graded) Sometimes even roughly centering the |
| data can help. Replace time by (time-115)/50 and note that |
| we are in better shape but still have problems. Also you |
| might run the cubic regression with the centered data to |
| make sure you understand the algebraic relationship among the |
| coefficients. |
| You may have noticed in part 6 that the output is incorrect.|
| The use of time*time has caused numerical inaccuracies in the |
| algorithm that decides the rank of our X matrix thereby |
| producing an inaccurate number of df for LOF. Rerun the |
| quadratic from part 6 with the CENTERED time variable and |
| note that the problem disappears. |
| 8. (optional - not graded) For the simple linear regression, |
| perform White's (1980) specification test. Do the usual |
| assumptions on the errors seem to hold? Compute a standard |
| error for the slope that would be valid in large samples |
| even in the presence of unequal error variances. |
| |
| Note: Questions of rank in computer programs depend on values |
| of "pivotol elements" Tuning parameters determine how close |
| these can get to 0 before being interpreted as 0s and thus |
| the matrix being deemed rank deficient. The critical values |
| of these tuning parameters are sometimes reset in updates of |
| SAS. These homework questions are accurate for version 6.12 |
| If you are using a later version and something changes, |
| simply note this in your answers. |
-----------------------------------------------------------------*/
data ice; input Time n @;
* time=(time-115)/50;
do i=1 to n; input length @;
output; end;
cards;
20 1 . <--- trick to peg X axis left end
50 1 19 (why isn't all this text messing
60 2 20 21 up my data step ???)
70 2 17 22
80 2 25 28
90 3 21 25 31
95 1 25
100 3 30 29 33
105 2 35 32
110 3 30 28 30
115 3 31 36 30
120 3 36 25 28
125 1 28
130 2 31 32
135 2 34 35
140 2 26 33
145 1 31
150 2 36 33
155 2 41 33
160 3 40 30 37
165 1 32
170 1 35
180 1 38
210 1 . <-- trick to peg X axis right end.
;
proc print;
proc gplot; plot length*time length*time length*time/overlay;
symbol1 v=diamond h=3 i=RL c=red;
symbol2 v=none i=join i=RQ c=green;
symbol3 v=none i=join i=RC c=blue;
proc glm; model length =
time|time|time|time|time|time|time|time|time|time|
time|time|time|time|time|time|time|time|time|time|
time;
proc means; run;