Announcement

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

  • Diagnostic tests for spatial dependence in Fixed Effects regression

    Hello everybody

    I am kindly asking you some help inherent spatial econometrics.

    I have to derive the Lagrange Multipliers values inherent spatial dependence for a fixed effects (xtreg) regression (in practice, to test whether a non spatial model is preferable to a spatial one).

    Now, there already exists such a command (spatdiag) but it only works for simple OLS regression.

    I was hence wondering if there exists an analogous command but for the xtreg (FE) regression (since I was not able to find anything).

    Thank you very much!

    Kodi

  • #2
    You could use the least squares dummy variable estimator, i.e. include dummy variables for the fixed effects instead of using xtreg, and use spatdiag afterwards.
    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

    Comment


    • #3
      Hi Jorge, thank you for your comment.

      Unfortunately, when I try with the LSDV estimator, spatdiag does not work, since it gives me the following error:

      factor variables and time-series operators not allowed
      r(101);


      Comment


      • #4
        Try using the LSDV estimator without using factor variables, by using the xi command instead. You could also try using areg

        Code:
        clear
        set matsize 5000
        webuse nlswork, clear
        keep in 1/100
        xtset idcode
        * xtreg
        xtreg ln_w age  ttl_exp tenure not_smsa south, fe
        * LSDV with factor variables
        reg ln_w age  ttl_exp tenure not_smsa south i.idcode
        * LSDV without factor variables
        xi i.idcode
        reg ln_w age  ttl_exp tenure not_smsa south _I*
        * areg version
        areg ln_w age  ttl_exp tenure not_smsa south, absorb(idcode)
        Jorge Eduardo Pérez Pérez
        www.jorgeperezperez.com

        Comment


        • #5
          Thank you very much Jorge! Now it works!

          Thank you!!!!!!!!!

          Comment


          • #6
            I used the above but it said

            HTML Code:
            xtreg $ylist $xlist, fe
            reg $ylist $xlist i.censuscode
            reg $ylist $xlist _I*
            
            spmat summarize idw_weights
            Summary of spatial-weighting object idw_weights
            ------------------------------------------------
                    Matrix |                    Description
            ---------------+--------------------------------
                Dimensions |                      536 x 536
                 Stored as |                      536 x 536
             Values        |
                       min |                              0
                     min>0 |                       .0164724
                      mean |                       .0018657
                       max |                              1
            ------------------------------------------------
            
            spatdiag, weights(idw_weights)
            Matrix idw_weights does not exist
            Please advise.

            Comment

            Working...
            X