Stat 301 Lab 3 – In Lab Overview

advertisement
Stat 301 Lab 3 – In Lab
Overview
In this lab you will be introduced to using JMP for simple linear regression analysis. For this lab
you need to be sitting in front of Windows PC that has JMP.
Warm-up Exercise
Simple Linear Regression (SLR) is available in two ways in JMP: Fit Y by X and Fit Model. Fit
Y by X and Fit Model are both on the Analyze menu. Multiple Regression and some advanced
SLR features are available only under Fit Model. This handout illustrates obtaining regression
output from Fit Y by X. JMP’s Fit Model analysis platform will be covered later.
In class we looked at the relationship between the annual global temperatures (Y) and the CO2
concentration, (X) for 20 years randomly selected from between 1943 and 2003. The year, 2007,
will be reserved to see if the simple linear regression line can predict the annual global
temperature in that year.
Year
CO2 (ppmv), X
1965
1966
1968
1970
1971
1972
1973
1974
1977
1979
1981
1984
1986
1987
1989
1991
1993
1996
1999
2002
2007
320.03
321.37
323.05
325.68
326.32
327.46
329.68
330.25
333.90
336.85
339.93
344.42
347.15
348.93
352.91
355.59
357.04
362.64
368.31
373.10
382.43
Global
Temperature, Y
13.85
13.92
13.91
14.04
13.90
13.95
14.18
13.94
14.16
14.14
14.40
14.15
14.19
14.35
14.26
14.44
14.19
14.39
14.46
14.69
.
1
Fit Y by X
1. You can create a data worksheet with three columns. To do this, click on the red triangle
next to Columns and Add Multiple Columns. Name the columns Year, CO2 and Temp.
Do not enter a value for Temp in 2007 (arrow down past this row and JMP will
automatically put a period in the cell indicating a missing value). Rather than spend the
time entering the data you can open the data table from the course web page.
2. Select Analyze + Fit Y by X.
3. Select Temp as the Y, Response and CO2 as the X, Factor then click OK. This
produces a plot of the data. You can change the axes scales by putting the cursor over the
axis and right clicking and choosing Axis Settings. For the vertical (Y) axis choose a
Minimum of 13.5, Maximum of 15, Increment of 0.5 and # Minor Ticks of 4. For the
horizontal axis choose a Minimum of 300, Maximum of 400, Increment of 50 and #
Minor Ticks of 4.
4. Using the analysis hidden menu (indicated by the little red triangle to the left of
Bivariate Fit of Temp by CO2), you can choose various fits and options including Fit
Mean, Fit Line, and Fit Polynomial, etc. Choosing a fit produces a table of output
below the plot corresponding to the fit. The fitted line/curve is also drawn on the plot and
a new hidden menu of options specific to the fit is created just below the plot (indicated
by the little red triangle to the left of the name of the fit chosen. Choosing options from
this new hidden menu either creates more output or creates new columns in the worksheet
(e.g. you can save the residuals from a particular fit as a new column in the worksheet for
further analysis). One can also fit a model, exclude a row, and re-fit the same model to
see the effect of the excluded point on the fit because JMP will graph both fitted
equations on the same scatter plot and provide both sets of output in the same analysis
window. JMP also provides many options (formatting and statistical) by simply Rightclicking on the items displayed (both graphical items and numerical/text items).
5. Select Fit Line from the analysis hidden menu (red triangle icon). Note the fitted line is
now on the plot of the data. Explore the output displayed below the scatter plot. Also
notice the new hidden menu below the plot (labeled Linear Fit); click here and notice
your analysis options.
6. Identify the following items from the Linear Fit output:
 The equation of the fitted line. (Note: JMP does not indicate that this is really a
predicted annual global temperature. You will need to add the word “predicted”
when you report the prediction equation.)
 R2 = RSquare
 sY|X = Root Mean Square Error (the estimate of the error standard deviation,  ).
 n = Observations (or Sum Wgts)
 Test statistic and P-value for the test of 1  0 vs. 1  0
7. Right-click on the table of Parameter Estimates at the bottom of the output. From the
resulting contextual pop-up menu, select Lower 95% from the Columns menu item.
Repeat this selecting Upper 95%. This adds two additional columns to this section of the
output. These columns provide 95% confidence intervals for the intercept and the slope
of the model: Y   0  1 X   .
8. From the Linear Fit hidden menu (just below the scatter plot), choose Confid Shaded Fit
to show 95% confidence bands for Y |X   0  1 X . Now, select Confid Shaded Indiv
to show 95% prediction bands for individual values of Y.
9. Save Predicteds and Save Residuals both create new columns in the JMP data table. Note
that even though 2007 was not used in the calculation of the prediction equation JMP will
2
predict a value for this year. Plot Residuals adds additional plots to the bottom of the
output – Residuals ( Y  Yˆ ) by Predicted ( Ŷ ) Plot, Actual by Predicted Plot, Residual by
Row Plot and Residual Normal Quantile Plot.
10. You can use Fit Y by X to plot Residuals by CO2. Change the Axis Setting so that the
vertical scale goes from –0.3 to 0.3 in increments of 0.1 with 1 minor tick. You can also
add a horizontal line at 0. This plot is used to assess whether there is the same amount of
variation in the residuals for all values of the explanatory variable.
11. You can use Analyze – Distribution of the Residuals to assess whether the conditions of
identically and normally distributed errors is satisfied.
Bivariate Fit of Temp By CO2
Linear Fit
Predicted Temp = 9.8815137 + 0.0125838*CO2
Summary of Fit
RSquare
RSquare Adj
Root Mean Square Error
Mean of Response
Observations (or Sum Wgts)
Analysis of Variance
Source
DF
Model
1
Error
18
C. Total
19
0.805887
0.795103
0.10356
14.1755
20
Sum of Squares
0.80145080
0.19304420
0.99449500
Parameter Estimates
Term
Estimate
Intercept
9.8815137
CO2
0.0125838
Std Error
0.497263
0.001456
Mean Square
0.801451
0.010725
t Ratio
19.87
8.64
F Ratio
74.7296
Prob > F
<.0001*
Prob>|t|
<.0001*
<.0001*
3
4
Download