Simple Linear Regression using SAS


The same as we did in correlation analysis, say we wish to look at the relationship between engine displacement (displ) and highway mpg (hwy); in other words, predicting hwy from displ using mpg data file.

proc reg data = mpg;
  model hwy = displ / stb;

SAS single linear regression 1

We see that the relationship between hwy and displ is positive (.19451) and based on the p-value (<.0001), we conclude this relationship is statistically significant.  Hence, there is a statistically significant positive linear relationship between engine displacement and highway mpg.

SAS also provide several plots for diagnosing the model fit, which is very sweet.

SAS single linear regression 2SAS single linear regression 3From the two plot above, we conclude the model fit is OK except couple of outliers.




See Also:

Do the same test in R

Leave a Reply

Your email address will not be published. Required fields are marked *