UNC-Wilmington ECN 377 Department of Economics and Finance

advertisement
UNC-Wilmington
Department of Economics and Finance
ECN 377
Dr. Chris Dumas
Regression Analysis in SAS
In SAS, Proc Reg can be used to conduct Ordinary Least Squares (OLS) Regression Analysis. (There are many
other procedures in SAS that can be used to conduct other, specialized types of regression analysis, but Proc Reg
is the basic regression procedure.)
Example SAS Program
/*
SOFTWARE: SAS Statistical Software program, version 9.2
AUTHOR: Dr. Chris Dumas, UNC-Wilmington, Fall 2015.
TITLE: Program to do OLS regressions.
*/
options
options
options
options
helpbrowser=sas;
number pageno=1 nodate nolabel font="SAS Monospace" 10;
leftmargin=1.00 in rightmargin=1.00 in ;
topmargin=1.00 in bottommargin=1.00 in;
/* Proc Import brings Excel data file OLSdata.xls into SAS and gives it the new
name dataset01. The dataset has 26 observations on three variables, Y, X1 and X2.
*/
proc import datafile="v:\ECN377\OLSdata.xls" dbms=xls out=dataset01 replace;
/* The Proc Reg command can be used to do OLS regressions. For example, the model
statement below requests a regression using Y as the dependent variable and X1 and
X2 as independent variables. */
proc reg data=dataset01;
model Y = X1 X2;
run;
[See next page for Output from SAS program.]
1
UNC-Wilmington
Department of Economics and Finance
ECN 377
Dr. Chris Dumas
Output from SAS Program
Key for SAS Program Output
The SAS System
05:54 Sunday, March 24, 2013
The REG Procedure
Model: MODEL1
Dependent Variable: Y Y
1. Name of dependent (Y) variable
2. Sample Size (n)
3. RSS
4. ESS
5. TSS
6. d.f. numerator for F-test
7. d.f. denominator for F-test
8. Ftest number
9.”Pr > F” gives p-value for Ftest
10. SER
11. Mean value of dependent (Y) variable
12. R2
13. Adjusted R2 (Rbar-squared)
14. List of independent (X) variables
15. “Parameter Estimate” column gives estimated
values of the 𝛽̂ ’s in the regression equation
16. standard errors (s.e’s.) of the 𝛽̂ ’s
17. ttest number for test:
H0: β = 0
H1: β ≠ 0
18. sum of DF in column = k (here, k = 3)
d.f. for tcritical = n – k (here, d.f. = 26 – 3 = 23)
19. “Pr > |t|” gives p-values for t-tests
3
1.
Number of Observations Read
Number of Observations Used
26
26
2.
Analysis of Variance
3. Sum of
4. Squares
Mean
Square
2
23
25
5. 1551.00585
775.50293
22.17199
Root MSE
Dependent Mean
Coeff Var
4.70871
14.96154
31.47212
Source
6.
Model
Error
Corrected Total
10
.
11
.
Variable
14
Intercept
.
X1
X2
7.
DF
509.95569
2060.96154
R-Square
Adj R-Sq
8.
9.
F Value
Pr > F
34.98
<.0001
0.7526
0.7310
12
.
13
.
Parameter Estimates
Label
Intercept
X1
X2
DF
Parameter
Estimate
Standard
Error
18
1
1 .
15
7.70949
.
0.90064
16
1.46982
0.14345 .
1
0.03093
0.05922
t Value
17
5.25
6.2810
0.52.
Pr > |t|
<.0001
<.0001
0.6064
19
.
2
Download