Simple Linear Regression
In simple linear regression, there is a single quantitative independent variable. Suppose, for example, that you want to determine whether a linear relationship exists between the asking price for a house and its area in square feet. The area of the house is the quantitative independent variable, and the asking price for the house is the dependent variable.
The data set analyzed in this example is called Houses, and it contains the characteristics of fifteen houses for sale. The data set contains the following variables.
- style
- style category (ranch, split-level, condominium, or two-story)
- sqfeet
- area in square feet
- bedrooms
- number of bedrooms
- baths
- number of bathrooms
- street
- name of the street on which the house is located
- price
- asking price for the house
The task includes performing a simple regression analysis to predict the variable
price from the explanatory variable,
sqfeet.
Open the Houses Data Set
The data are provided in the Analyst Sample Library. To open the
Houses data set, follow these steps:
- Select Tools Sample Data ...
- Select Houses.
- Click OK to create the sample data set in your Sasuser directory.
- Select File Open By SAS Name ...
- Select Sasuser from the list of Libraries.
- Select Houses from the list of members.
- Click OK to bring the Houses data set into the data table.
Request the Simple Regression Analysis
To request the simple regression analysis, follow these steps:
- Select Statistics Regression Simple ...
- Select price from the candidate list as the Dependent variable.
- Select sqfeet from the candidate list as the Explanatory variable.
Figure 11.2 displays the resulting dialog.
Figure 11.2: Simple Linear Regression Dialog
The model defined in this analysis is
- price = b0 + b1sqfeet
If you select
Quadratic or
Cubic in the
Model box, the respective model is
- price = b0 + b1sqfeet + b2 sqfeet2
or
- price = b0 + b1 sqfeet + b2 sqfeet2 + b3 sqfeet3
The default analysis fits the simple regression model.
Request a Scatter Plot of the Data
To request a plot of the observed values versus the independent values, follow these steps.
- Click on the Plots button.
- Select Plot observed vs independent.
You can add 95% confidence limits for the mean of the independent variable by selecting
Confidence limits, or you can produce 95% prediction limits for individual predictions.
- Click OK.
Figure 11.3: Simple Linear Regression: Plots Dialog
Click
OK in the Simple Linear Regression dialog to perform the analysis.
Review the Results
The results are displayed in
Figure 11.4. The ANOVA table is displayed in the results, followed by the table of parameter estimates. The least squares fit is
- price = -14982 + 67.52×sqfeet
Figure 11.4: Simple Linear Regression: Results
The small p-values listed in the Pr > column indicate that both parameter estimates are significantly different from zero.
The plot of the observed and independent variables is displayed in Figure 11.5. The plot includes the fitted regression line.
Figure 11.5: Simple Linear Regression: Scatter Plot with Regression Line
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.