lab05, homework
Homework
Chapter 5 example
Questions
/*--------hw5-----------------------------------------------------
| Homework 5: There is a watershed data set and exercises |
| at the end of chapter 5. Below I give you the |
| input step to create the sas data set, and a step to create |
| a new variable LQ = log(Q). It is up to you to create any |
| other log transformed variables as needed. |
*----------------------------------------------------------------*/
/*--------------------QUESTIONS----------------------------------*
- What do the WITH statement and NOSIMPLE option do in PROC CORR?
How do you think I selected the two variables for the "floor"
of my 3-dimensional plot?
- Plot "jittering" :
Add an imperceptible random perturbation to STREAM as follows:
S=STREAM + .001*ranuni(1);
then redo the G3D plot with S replacing STREAM. Explain the
difference in the two graphs. (i.e what did you learn about
PROC G3D?
- Work the problems (5.1 through 5.6) in chapter 5.
Taken together, these are a nice analysis of the data.
- For problem 5.4, I do not regard the intercept as a "variable"
and would leave it in until the end (then look at its
significance as the book suggests).
- For the confidence interval problems, I WOULD consider beta0
to be one of the parameters (in 5.5)
- Note the term "confidence region" not "interval" in 5.6
and the explicit instruction to ignore other parameters, such
as beta0. The idea here would be to invert the 2x2 covariance
matrix for b8 and b9, and from that compute the confidence
elipse. A rough plot like the one for the cans example in
our class notes is fine, although you could also use the
quadratic formula to calculate pairs of points exactly on the
elipse boundary.
- As an optional part, (not graded) you might want to
calculate the elipse axis lengths and check against your plot.
- SAS note: PROC REG; MODEL Y=X1--X12; DELETE X7; is valid SAS
syntax. This makes 5.4 rather quick.
Additional problems for the log scale model:
- Using the full model (with the intercept and all variables
from log(totarea) through log(time) you have 10 betas. Using
this full model, test the null hypothesis K'Beta=0 where
| 0 0 0 0 0 1 0 0 0 0 |
K' = | 0 0 0 1 -1 0 0 0 0 0 |
| 0 0 3 0 0 0 0 1 0 0 |
Also state this hypothesis in terms of the betas. I am asking
you simply to multiply out the matrix expression and state the
hypothesis as you would to a client.
- Plot the residuals from your final model against
the predicted values. This plot should show a random scatter
if the model is OK. Does it appear as it should?
- (By final model, I mean the one you got by leaving out
variables, not the one with K'Beta=0)
- Finally, PROC UNIVARIATE NORMAL PLOT; VAR R; will test the
null hypothesis that R has a normal distribution. Do this for
the residuals from your final model. Report the P-value and
your conclusion about H0: ( H0: Errors are normal ).
- (PROC REG; MODEL ...; OUTPUT OUT=OUT1 RESIDUAL=R; will put the
residuals in data set OUT1 with the name R, PREDICTED=P will
add in the predicted values)
************************
***** SAS Code *********
************************
================================================================
| |
| optional (not graded): Compute confidence limits for the mean |
| LQ at each of our observed sets of explanatory variables. |
| Output these and convert them back to the original scale. |
| Figure out a way to compute the Scheffe adjustment so that we |
| are 95% confident that ALL of our confidence intervals contain |
| the true values of mean LQ. Compute these, output them, and |
| convert back to the original scale. |
*---------------------------------------------------------------*/