Docstoc

REN 576

Document Sample
REN 576 Powered By Docstoc
					REN 576                Lab 5: Non-Spherical Disturbances
Create a data set in Excel

We are going to create a data set of 50 observations in Excel to use in SAS.
The data set will have two independent variables, two random errors and two dependent
variables. The first random error will be autocorrelated. The second will be heteroskedastic.

Use these formulas to create the independent variables and errors:
For X1(all observations): ‘=5*rand( )’.
For X2 (all observations): ‘=10*rand( )’
For e1 (first observation only) : ‘=3*rand( )’
       (for obs 2): ‘=0.7*D2+3*rand( )’
       (for the rest of the observations copy second observation down).
For e2 (first 25 observations): ‘=2*rand( )’
       (for last 25 observations): ‘=4*rand( )’

Each dependent variable will be created as a linear combination of the independent variables and
one of the random errors.

Use these formulas to create the dependent variables:
For Y1 (OBS=1): ‘=1+2*B2+3*C2+D2
For Y1 (for the rest of the observations copy the first observation down)
For Y2 (OBS=1): ‘=4+5*B2+6*C2+E2
For Y2 (for the rest of the observations copy the first observation down)
Import the Data into a SAS file
You should know how to do this by now.

In SAS Analyst estimate the regression equations by OLS and test for autocorrelation and
heteroskedasticity


In the SAS Program Editor write a program to invoke the procedure that will test for
autocorrelation or heteroskedasticity and estimate the models more efficiently


This part of this exercise involves using www.uri.edu/SASDOC to find the appropriate SAS
procedure and programming codes for this problem

Write the SAS Program codes you use here:




Finally, fill in the blanks of the table below and answer the questions.
                                 Model 1                          Model 2
                                OLS      EGLS                    OLS      EGLS

Intercept
(s.e.)

X1
(s.e.)

X2
(s.e)

F

R-Square

R-Bar Square



DW/ARCHTest

DW/LM/Q Prob

    1. What are the true models for Y1 and Y2?




    2. Which estimated coefficients are unbiased?




    3. Which estimated coefficients are efficient?




    4. Which estimated standard errors are unbiased?
                                                       08:03 Wednesday, October 27, 2004   1
                                 The REG Procedure
                                   Model: MODEL1
                             Dependent Variable: Y2 Y2

                                  Analysis of Variance

                                        Sum of             Mean
 Source                  DF            Squares           Square     F Value    Pr > F

 Model                    2              20788             10394    8178.04    <.0001
 Error                   47           59.73512           1.27096
 Corrected Total         49              20848


              Root MSE                 1.12737    R-Square         0.9971
              Dependent Mean          50.19484    Adj R-Sq         0.9970
              Coeff Var                2.24599


                                  Parameter Estimates

                                     Parameter      Standard
Variable    Label       DF            Estimate         Error       t Value    Pr > |t|

Intercept   Intercept    1            5.53455           0.43295      12.78      <.0001
X1          X1           1            5.03422           0.11163      45.10      <.0001
X2          X2           1            5.97855           0.05185     115.30      <.0001
                                                          08:03 Wednesday, October 27, 2004   2

                                 The REG Procedure
                                   Model: MODEL1
                             Dependent Variable: Y1 Y1

                                  Analysis of Variance

                                        Sum of             Mean
 Source                  DF            Squares           Square     F Value    Pr > F

 Model                    2         5136.92132     2568.46066       1594.86    <.0001
 Error                   47           75.69184        1.61046
 Corrected Total         49         5212.61316


              Root MSE                 1.26904    R-Square         0.9855
              Dependent Mean          26.92552    Adj R-Sq         0.9849
              Coeff Var                4.71315


                                  Parameter Estimates

                                     Parameter      Standard
Variable    Label       DF            Estimate         Error       t Value    Pr > |t|

Intercept   Intercept    1            5.46508           0.48735      11.21      <.0001
X1          X1           1            2.13025           0.12566      16.95      <.0001
X2          X2           1            3.04649           0.05837      52.20      <.0001
                                                          08:03 Wednesday, October 27, 2004   3

                                 The REG Procedure
                                   Model: MODEL1
                             Dependent Variable: Y2 Y2

                              Test of First and Second
                                Moment Specification

                             DF     Chi-Square     Pr > ChiSq

                              5           3.55           0.6162
Durbin-Watson D                   1.791
Number of Observations               50
1st Order Autocorrelation         0.069
                                 08:03 Wednesday, October 27, 2004   4

         The REG Procedure
           Model: MODEL1
     Dependent Variable: Y1 Y1

      Test of First and Second
        Moment Specification

     DF    Chi-Square       Pr > ChiSq

      5         6.05            0.3013


Durbin-Watson D                  0.559
Number of Observations              50
1st Order Autocorrelation        0.670
    http://www.uri.edu/sasdoc/ets/chap8/sect3.htm#idxaut0010


Autoregressive Error Model

The following statements regress Y on TIME with the errors assumed to follow a second-order
autoregressive process. The order of the autoregressive model is specified by the NLAG=2
option. The Yule-Walker estimation method is used by default. The example uses the
METHOD=ML option to specify the exact maximum likelihood method instead.
    proc autoreg data=a;
       model y = time / nlag=2 method=ml;
    run;




    AUTOCORRELATION

    Our code***

options pageno=1;
proc reg data=Work.Lab5;
   model Y1 = X1 X2 / dwprob nlag=1 ;
run;
     quit;
                                      08:03 Wednesday, October 27, 2004          1

                                             The AUTOREG Procedure

                                            Dependent Variable      Y1
                                                                    Y1


                                      Ordinary Least Squares Estimates

                  SSE                 75.6918351    DFE                       47
                  MSE                    1.61046    Root MSE             1.26904
                  SBC                 174.362287    AIC               168.626218
                  Regress R-Square        0.9855    Total R-Square        0.9855
                  Durbin-Watson           0.5586    Pr < DW               <.0001
                  Pr > DW                 1.0000
NOTE: Pr<DW is the p-value for testing positive autocorrelation, and Pr>DW is the p-value for
      testing negative autocorrelation.


                                                     Standard                Approx          Variable
       Variable         DF      Estimate                Error   t Value    Pr > |t|          Label

       Intercept         1          5.4651            0.4874      11.21        <.0001
       X1                1          2.1302            0.1257      16.95        <.0001        X1
       X2                1          3.0465            0.0584      52.20        <.0001        X2


                                          Estimates of Autocorrelations

          Lag      Covariance       Correlation          -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1

            0         1.5138              1.000000      |                      |********************|
            1         1.0149              0.670441      |                      |*************       |


                                          Preliminary MSE        0.8334


                                   Estimates of Autoregressive Parameters

                                                                Standard
                             Lag          Coefficient              Error   t Value

                                      1         -0.670441           0.109396         -6.13




Heteroskedasticity
        LINEAR
        specifies the linear function; that is, the HETERO statement variables predict the error
        variance linearly. The following model is estimated when you specify LINK=LINEAR:
*** Linear Regression ***;
options pageno=1;
proc autoreg data=Work.Lab5;
   model Y2 = X1 X2 / archtest;
         hetero D/ link=linear test=lm;
run;
     quit;


                                                                      08:03 Wednesday, October 27, 2004   1

                                              The AUTOREG Procedure

                                          Dependent Variable       Y1
                                                                   Y1


                                       Ordinary Least Squares Estimates

                  SSE                 75.6918351    DFE                       47
                  MSE                    1.61046    Root MSE             1.26904
                  SBC                 174.362287    AIC               168.626218
                  Regress R-Square        0.9855    Total R-Square        0.9855
                  Durbin-Watson           0.5586    Pr < DW               <.0001
                  Pr > DW                 1.0000
NOTE: Pr<DW is the p-value for testing positive autocorrelation, and Pr>DW is the p-value for
      testing negative autocorrelation.


                                                   Standard                  Approx   Variable
       Variable         DF      Estimate              Error   t Value      Pr > |t|   Label

       Intercept         1           5.4651         0.4874      11.21       <.0001
       X1                1           2.1302         0.1257      16.95       <.0001    X1
       X2                1           3.0465         0.0584      52.20       <.0001    X2


                                        Estimates of Autocorrelations

          Lag      Covariance        Correlation       -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1

            0         1.5138            1.000000      |                     |********************|
            1         1.0149            0.670441      |                     |*************       |


                                        Preliminary MSE         0.8334


                                    Estimates of Autoregressive Parameters

                                                              Standard
                             Lag        Coefficient              Error    t Value

                                1         -0.670441           0.109396       -6.13
                                                                08:03 Wednesday, October 27, 2004   2

                                        The AUTOREG Procedure

                                        Yule-Walker Estimates

                  SSE                 34.5762675    DFE                       46
                  MSE                    0.75166    Root MSE             0.86698
                  SBC                 139.696084    AIC               132.047992
                  Regress R-Square        0.9960    Total R-Square        0.9934
                  Durbin-Watson           1.5521    Pr < DW               0.0765
                  Pr > DW                 0.9235
NOTE: Pr<DW is the p-value for testing positive autocorrelation, and Pr>DW is the p-value for
      testing negative autocorrelation.


                                            Standard                  Approx    Variable
       Variable       DF     Estimate          Error    t Value     Pr > |t|    Label

       Intercept       1       5.9214         0.4306      13.75       <.0001
       X1              1       2.0107         0.0644      31.22       <.0001    X1
       X2              1       3.0138         0.0302      99.88       <.0001    X2
                                                             08:03 Wednesday, October 27, 2004   1

                                    The AUTOREG Procedure

                                   Dependent Variable      Y2
                                                           Y2


                            Ordinary Least Squares Estimates

            SSE                    59.7351193       DFE                          47
            MSE                       1.27096       Root MSE                1.12737
            SBC                    162.524778       AIC                  156.788709
            Regress R-Square           0.9971       Total R-Square           0.9971
            Durbin-Watson              1.7908


                          Q and LM Tests for ARCH Disturbances

                Order                Q    Pr > Q                 LM     Pr > LM

                   1         2.2946       0.1298          1.9805         0.1593
                   2         5.1794       0.0750          4.0953         0.1290
                   3         6.0210       0.1106          4.2986         0.2310
                   4         6.4619       0.1672          5.5172         0.2382
                   5         6.8542       0.2317          6.2022         0.2870
                   6         7.0237       0.3187          6.8490         0.3350
                   7         7.3808       0.3903          7.0916         0.4194
                   8        10.9244       0.2060          8.7188         0.3666
                   9        11.3836       0.2503          8.7346         0.4621
                  10        11.5477       0.3165          8.7437         0.5566
                  11        16.2716       0.1313         14.0898         0.2281
                  12        17.2841       0.1392         15.3651         0.2221


                                         Standard                       Approx    Variable
Variable         DF      Estimate           Error      t Value        Pr > |t|    Label

Intercept         1       5.5345          0.4329         12.78         <.0001
X1                1       5.0342          0.1116         45.10         <.0001     X1
X2                1       5.9785          0.0519        115.30         <.0001     X2


            Algorithm converged.
                                                         08:03 Wednesday, October 27, 2004   2

                                 The AUTOREG Procedure

                        Linear Heteroscedasticity Estimates

            SSE              70.6339075      Observations                50
            MSE                 1.41268      Root MSE               1.18856
            Log Likelihood   -68.485113      Total R-Square          0.9966
            SBC              156.530342      AIC                 146.970227
            Normality Test       4.4414      Pr > ChiSq              0.1085
            Hetero Test         15.4045      Pr > ChiSq              <.0001


                                     Standard                   Approx   Variable
Variable       DF     Estimate          Error    t Value      Pr > |t|   Label

Intercept       1       5.1175         0.2879      17.78       <.0001
X1              1       4.9615         0.0943      52.60       <.0001    X1
X2              1       6.0174         0.0353     170.41       <.0001    X2
HET0            1       0.5736         0.1415       4.05       <.0001
HET1            1       6.5885         4.9216       1.34       0.1807

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:11
posted:12/19/2011
language:
pages:11