# LM Autocorrelation problem with Weight option

I use the following command to calculate an LM Autocorrelation test. Without the WEIGHT option there is no problem, but the problem with WEIGHT option was that I got different results. Why?

Here is the code:

sample 1 17
1   99.20  96.70  101.0
2   99.00  98.10  100.1
3   100.0  100.0  100.0
4   111.6  104.9  90.60
5   122.2  104.9  86.50
6   117.6  109.5  89.70
7   121.1  110.8  90.60
8   136.0  112.3  82.80
9   154.2  109.3  70.10
10  153.6  105.3  65.40
11  158.5  101.7  61.30
12  140.6  95.40  62.50
13  136.2  96.40  63.60
14  168.0  97.60  52.60
15  154.3  102.4  59.70
16  149.0  101.6  59.50
17  165.5  103.8  61.30

set NODEL
?OLS Y X1 X2 / resid=E ut
diag / acf
gen E1=lag(E,1)
?OLS E E1 x1 x2 /
gen1  sqrt($N*$R2)

?OLS Y X1 X2 / resid=E weight=X2 ut
diag / acf
gen E1=Lag(E,1)
?OLS E E1 x1 x2 /
gen1  sqrt($N*$R2)


Here is the output:

|_set NODEL
|_?OLS Y X1 X2 / resid=E ut
|_diag / acf

REQUIRED MEMORY IS PAR=       5 CURRENT PAR=  112400
DEPENDENT VARIABLE = Y               17 OBSERVATIONS
REGRESSION COEFFICIENTS
1.06170962850      -1.38298545741       130.706587487

RESIDUAL CORRELOGRAM
LM-TEST FOR HJ:RHO(J)=0, STATISTIC IS STANDARD NORMAL
LAG     RHO       STD ERR     T-STAT     LM-STAT    DW-TEST BOX-PIERCE-LJUNG
1    -0.1455     0.2425    -0.5998     0.7014     2.0185     0.4272
2    -0.2231     0.2425    -0.9200     1.2257     2.0359     1.4994
3     0.1871     0.2425     0.7716     0.9975     1.1956     2.3074
4    -0.3002     0.2425    -1.2377     1.7388     2.0133     4.5462
LM CHI-SQUARE STATISTIC WITH   4  D.F. IS     3.333

|_gen E1=lag(E,1)
...NOTE..LAG VALUE IN UNDEFINED OBSERVATIONS SET TO ZERO
|_?OLS E E1 x1 x2 /
|_gen1  sqrt($N*$R2)
...NOTE..CURRENT VALUE OF $N = 17.000 ...NOTE..CURRENT VALUE OF$R2  =  0.28942E-01
0.70143480

|_?OLS Y X1 X2 / resid=E weight=X2 ut
|_diag / acf
REQUIRED MEMORY IS PAR=       5 CURRENT PAR=  112400
DEPENDENT VARIABLE = Y               17 OBSERVATIONS
REGRESSION COEFFICIENTS
0.975798381981      -1.36603123581       138.217582873

RESIDUAL CORRELOGRAM
LM-TEST FOR HJ:RHO(J)=0, STATISTIC IS STANDARD NORMAL
LAG     RHO       STD ERR     T-STAT     LM-STAT    DW-TEST BOX-PIERCE-LJUNG
1    -0.1453     0.2425    -0.5990     0.6957     2.0257     0.4261
2    -0.2332     0.2425    -0.9615     1.2576     2.0795     1.5972
3     0.1883     0.2425     0.7762     1.0115     1.2232     2.4148
4    -0.3195     0.2425    -1.3174     1.8588     2.0829     4.9515
LM CHI-SQUARE STATISTIC WITH   4  D.F. IS     3.621

|_gen E1=lag(E,1)
...NOTE..LAG VALUE IN UNDEFINED OBSERVATIONS SET TO ...
edit retag close merge delete

Sort by » oldest newest most voted

Weighted Least Squares is different to Ordinary Least Squares and is used when the assumption of constant variance is violated. You need to read up on the difference but your model assumes that the error variance is directly related to X2. The Weighted Least Squares estimate $\hat{\beta}_{w}$ is obtained by applying OLS to the transformed model:

$$\sqrt{N_t}Y_t=\sqrt{N_t}X^{'}_t\beta +v_t$$

The model in both cases fits poorly and you may want to think again about it.

more

The WEIGHT option performs Weighted Least Squares (WLS). OLS with the WEIGHT= option is similar to a GLS regression with a diagonal Omega matrix. One application of WLS is as a correction for heteroskedasticity.

more

Now the code again

OLS Y X1 X2 / resid=E weight=X2 ut
diag / acf

gen E1=lag(E,1)
?OLS E E1 x1 x2 /
gen1  sqrt($N*$R2)


Why I got different results? Thanks in advance

( 2016-09-08 13:00:09 +0000 )edit