of whether the patient is a surgical or medical patient (0 = surgical, 1 = medical), and an index measuring the patient’s anxiety level. We start by building a simple linear regression model relating the response variable satisfaction to severity.
Figure 2.6 is a scatter diagram of satisfaction versus severity. There is a relatively mild indication of a potential linear relationship between these two variables. The output from JMP for fitting a simple linear regression model to these data is shown in Figure 2.7. JMP is an SAS product that is a menu-based PC statistics package with an extensive array of regression modeling and analysis capabilities.
At the top of the JMP output is the scatter plot of the satisfaction and severity data, along with the fitted regression line. The straight line fit looks reasonable although there is considerable variability in the observations around the regression line. The second plot is a graph of the actual satisfaction response versus the predicted response. If the model were a perfect fit to the data all of the points in this plot would lie exactly along the 45-degree line. Clearly, this model does not provide a perfect fit. Also, notice that while the regressor variable is significant (the ANOVA F statistic is 17.1114 with a P value that is less than 0.0004), the coefficient of determination R2 = 0.43. That is, the model only accounts for about 43% of the variability in the data. It can be shown by the methods discussed in Chapter 4 that there are no fundamental problems with the underlying assumptions or measures of model adequacy, other than the rather low value of R2.
Figure 2.6 Scatter diagram of satisfaction versus severity.
Figure 2.7 JMP output for the simple linear regression model for the patient satisfaction data.
Low values for R2 occur occasionally in practice. The model is significant, there are no obvious problems with assumptions or other indications of model inadequacy, but the proportion of variability explained by the model is low. Now this is not an entirely disastrous situation. There are many situations where explaining 30 to 40% of the variability in y with a single predictor provides information of considerable value to the analyst. Sometimes, a low value of R2 results from having a lot of variability in the measurements of the response due to perhaps the type of measuring instrument being used, or the skill of the person making the measurements. Here the variability in the response probably arises because the response is an expression of opinion, which can be very subjective. Also, the measurements are taken on human patients, and there can be considerably variability both within people and between people. Sometimes, a low value of R2 is a result of a poorly specified model. In these cases the model can often be improved by the addition of one or more predictor or regressor variables. We see in Chapter 3 that the addition of another regressor results in considerable improvement of this model.
2.8 DOES PITCHING WIN BASEBALL GAMES?
Part of the never-ending debate about what makes a winning baseball team is the theory that a team cannot win consistently without good pitching. Baseball is a sport deeply rooted in analytics and there is an ever-growing body of data available. Major league baseball now has a system in all stadiums that includes cameras and other sensors to collect data on every pitch, including pitch speed, player positions, launch angle for balls hit in the air, and so forth. Table B.22 contains a summary of performance for 2016 for all National and American League baseball teams. The response variable is the number of games won and among the various statistics listed is the team earned run average (ERA), a standard measure of pitching performance, with low values of team ERA generally attributed to an outstanding pitching staff. Figure 2.8 is the JMP output from fitting a linear regression model to wins versus the ERA data. The plots of wins versus ERA and actual versus predicted show that there is definitely a linear relationship between these variables. The model is significant and it seems that one point of team ERA is equivalent to about 18.6 wins. JMP also produces a plot of residuals versus the predicted number of wins. Residual plots such as this are useful in assessing model adequacy. We will discuss this in detail later but this plot indicates that there is no structure in the relationship between the residuals and the predicted number of wins. This is one indication that the model fit is satisfactory. However, the model only explains about 63% of the variability in the response. While this is not bad, it does suggest that there may be other useful explanatory variables.
Figure 2.8 JMP output for the model relating team wins to team ERA for the 2016 baseball season.
2.9 USING SAS® AND R FOR SIMPLE LINEAR REGRESSION
The purpose of this section is to introduce readers to SAS and to R. Appendix D gives more details about using SAS, including how to import data from both text and EXCEL files. Appendix E introduces the R statistical software package. R is becoming increasingly popular since it is free over the Internet.
Table 2.7 gives the SAS source code to analyze the rocket propellant data that we have been analyzing throughout this chapter. Appendix D provides detail explaining how to enter the data into SAS. The statement PROC REG tells the software that we wish to perform an ordinary least-squares linear regression analysis. The “model” statement specifies the specific model and tells the software which analyses to perform. The variable name to the left of the equal sign is the response. The variables to the right of the equal sign but before the solidus are the regressors. The information after the solidus specifies additional analyses. By default, SAS prints the analysis-of-variance table and the tests on the individual coefficients. In this case, we have specified three options: “p” asks SAS to print the predicted values, “clm” (which stands for confidence limit, mean) asks SAS to print the confidence band, and “cli” (which stands for confidence limit, individual observations) asks SAS to print the prediction band.
Table 2.8 gives the SAS output for this analysis. PROC REG always produces the analysis-of-variance table and the information on the parameter estimates. The “p clm cli” options on the model statement produced the remainder of the output file.
TABLE 2.7 SAS Code for Rocket Propellant Data
data rocket;
|
|
input shear age;
|
|
cards;
|
|
2158.70
|
15.50
|
1678.15
|
23.75
|
2316.00
|
8.00
|