Lab 3 - Stat 5511

advertisement
Lab 3 - Stat 5511 – Spring 2011
A little proof of SST = SSR + SSRES
ANOVA Table
Resource
Model
Error
Corrected total
DF
1
n-2
n-2
Sum of squares
SSR
SSRES
SST
Mean Square
MSR
MSRES
F-Value
Pr>F
In today’s lab, we want to use diameter to predict the height of a spruce tree using a sample of 10 trees.
In the ~/5511 directory (cd 5511), create a sptree.dat file (pico sptree.dat) with the following data (Note: Only
input numerical values into your sptree.dat file and only single space between two columns)
Diameter
Height
15.5
18.9
20.0
29.8
20.3
22.0
23.6
19.4
20.0
19.8
22.0
16.8
20.0
19.2
21.2
17.8
22.3
18.9
20.2
20.0
18.0
.
<---Here we want to predict the height and construct CI and PI for diameter x=22.0
 Note that in the height column we need a period ‘.’, which represents a
missing numerical value.(The dataset you have to do problem 2.3 on page 54,
has these in it. This would help you solve part e if it had been assigned.)
Here the SAS program needed is:
options ls=80;
data tree;
infile 'sptree.dat';
input diameter height;
run;
proc reg data=tree;
model height=diameter/p cli clm alpha=.l;
test diameter=5;
run;
proc print data=tree;
proc plot data=tree;
plot height*diameter;
run;
1. SAS gives us ways to calculate predicted values, confidence intervals, and prediction intervals. To do
this we add the following procedures in our SAS codes.
proc reg data=tree;
model height=diameter / p cli clm alpha=.l;
Here, after the slash /, there are some options for the regression model,
p - gives the predicted values (i.e. it puts your independent variable(s) into regression equation and it
predicts your dependent variable).
cli –Requests the prediction interval for an individual predicted value
clm – Prints the confidence interval for the expected value of the dependent value (mean) for each
observation.
alpha=.l sets α=.1, the default is α=.05
2. Fit a simple linear regression height=β0+β1*diameter and test H0: β1=5 (Namely, you want to test if the
slope is equal to 5).
test diameter=5;
The default hypothesis test is H0: β1=0 (test the significance of β1)
In general, you can test H1: β1=ρ where ρ is any real number. As you might have guessed (in case you
didn't guess...), the SAS code for that is: test diameter=ρ; Also note that you can test any variable, so if
we wanted to test H0: β0=3, we would type test intercept=3;
3. We are also able to get a prediction interval for a future observation. To do this, we input a period for
our dependent variable (height) and a value for our independent variable (diameter). In our data, add this
line at the bottom: “22 .”
Download