Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to deal with error correlation model with Stata

    regression function is :
    Click image for larger version

Name:	11111.jpg
Views:	1
Size:	6.2 KB
ID:	1537885

    Click image for larger version

Name:	2222.jpg
Views:	1
Size:	11.7 KB
ID:	1537886





    In the following data, variable value is the value of 1952, pi1952 is the price index based on 1952
    and the time range is from 1953-1978. So, I drop data if year is 1952 and 1990 after changing based price using 1990 price index.
    note: when t=0, it means 1978 and t-1 is 1977.

    data:
    [CODE]
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int t double(value pi1952)
    1952 80.7 1
    1953 115.3 .988
    1954 140.9 .982
    1955 145.5 .94
    1956 219.6 .937
    1957 187 .897
    1958 333 .901
    1959 435.7 .976
    1960 473 .973
    1961 227.6 .955
    1962 175.1 1.025
    1963 215.3 1.075
    1964 290.3 1.053
    1965 350.1 1.018
    1966 406.8 .998
    1967 323.7 1.002
    1968 300.2 .967
    1969 406.9 .945
    1970 545.9 .945
    1971 603 .955
    1972 622.1 .967
    1973 664.5 .968
    1974 748.1 .969
    1975 880.3 .981
    1976 865.1 .988
    1977 911.1 1.002
    1978 1073.9 1.008
    1990 . 1.862
    end

    I change the value to 1990 price, and related codes are as following:
    gen index=1/1.862
    gen pi1990=pi1952*index
    gen year=t-1978
    drop in 1
    tsset year,yearly
    replace value=value/pi1990
    gen lv=log(value)
    drop if t==1990
    reg lv year
    predict e,res
    twoway (scatter e e2)(lfit e e2)
    twoway (scatter e e3)(lfit e e3)
    estat bgo // Prob > chi2 0.0036<0.05
    wntestq e1 //Prob > chi2(11) = 0.0469
    di 26^(1/4) // and gain 3

    newey lv year,lag(3)

    I actually regress the data and cannot obtain the same coefficients as the author.
    I don't know what problems I have in my codes, please help me.

    and my results:
    Click image for larger version

Name:	5555.jpg
Views:	1
Size:	21.7 KB
ID:	1537882






    but the author gains coefficients like this:
    Click image for larger version

Name:	3333.jpg
Views:	1
Size:	8.4 KB
ID:	1537883

    Click image for larger version

Name:	44444.jpg
Views:	1
Size:	11.3 KB
ID:	1537884

    Last edited by Sc Meng; 22 Feb 2020, 07:28.

  • #2
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int t double(value pi1952)
    1952   80.7     1
    1953  115.3  .988
    1954  140.9  .982
    1955  145.5   .94
    1956  219.6  .937
    1957    187  .897
    1958    333  .901
    1959  435.7  .976
    1960    473  .973
    1961  227.6  .955
    1962  175.1 1.025
    1963  215.3 1.075
    1964  290.3 1.053
    1965  350.1 1.018
    1966  406.8  .998
    1967  323.7 1.002
    1968  300.2  .967
    1969  406.9  .945
    1970  545.9  .945
    1971    603  .955
    1972  622.1  .967
    1973  664.5  .968
    1974  748.1  .969
    1975  880.3  .981
    1976  865.1  .988
    1977  911.1 1.002
    1978 1073.9 1.008
    1990      . 1.862
    end

    Comment


    • #3
      Waiting for help

      Comment


      • #4
        This regression seems to be different from common AR models because it just needs to regress the value(y) with time trend(x) but not other independent variable. Meanwhile, one should address the autocorrelation problem. Thanks very for you help in advance

        Comment


        • #5
          gen index=1/1.862 //
          gen pi1990=pi1952*index
          gen year=_n
          drop in 1
          order year
          tsset year,yearly
          replace value=value/pi1990
          gen lv=log(value)
          //gen lv1=log(value1)
          drop if t==1990
          dfuller lv, trend //t= -2.339> -3.600
          di 26^(1/4) //2.2581009
          dfuller lv,lags(3) reg trend //
          dfuller lv,lags(2) reg trend //
          dfuller lv,lags(1) reg trend // statistically significant
          pperron lv //
          dfgls lv //
          kpss lv, trend //

          how can I continue my work, thanks

          Comment


          • #6
            um.....

            Comment

            Working...
            X