Announcement

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

  • areg command not working

    Hello All,
    I tried running a simple command:
    reg haz06 odf i.village, and got the results (attached):


    haz06 Coef. Std. Err. t P>t [95% Conf. Interval]

    odf .6266667 .3014252 2.08 0.038 .0349016 1.218432

    village
    Pachrukhi .1234444 .2756082 0.45 0.654 -.417636 .6645249
    Gerui -.1427083 .2714184 -0.53 0.599 -.6755634 .3901467
    Nagwa .7018452 .2622151 2.68 0.008 .1870584 1.216632
    Hathigarwa -.2654386 .287602 -0.92 0.356 -.8300656 .2991884
    Itowa -.0629487 .3063975 -0.21 0.837 -.6644755 .5385781
    Talbhirona .0541257 .2575683 0.21 0.834 -.4515384 .5597898
    Puraina -.0127778 .2970486 -0.04 0.966 -.5959505 .570395
    Marukharkala -.1656 .2908106 -0.57 0.569 -.7365263 .4053263
    Harni Bujurg -.0864966 .2701229 -0.32 0.749 -.6168082 .443815
    Sonversa -.2871088 .2701229 -1.06 0.288 -.8174204 .2432027
    Rampurwa .0075806 .3237262 0.02 0.981 -.6279662 .6431274
    Soherwalia -.1991026 .3205579 -0.62 0.535 -.8284294 .4302242
    Jabbar .3755303 .277116 1.36 0.176 -.1685103 .9195709
    Sade Kala .3485556 .2756082 1.26 0.206 -.1925249 .889636
    Sade Khurd -.1911594 .2741581 -0.70 0.486 -.7293931 .3470743
    Bankasiya 0 (omitted)

    _cons -1.771667 .198216 -8.94 0.000 -2.160809 -1.382524





    But when I run areg haz06 odf, absorb(village), I do not get the coefficient on odf:

    . areg haz06 odf, absorb(village)
    note: odf omitted because of collinearity

    Linear regression, absorbing indicators Number of obs = 746
    F( 0, 729) = .
    Prob > F = .
    R-squared = 0.0684
    Adj R-squared = 0.0479
    Root MSE = 1.2846


    haz06 Coef. Std. Err. t P>t [95% Conf. Interval]

    odf 0 (omitted)
    _cons -1.579263 .0470321 -33.58 0.000 -1.671597 -1.486928

    village F(16, 729) = 3.344 0.000 (17 categories)

    Can you please explain why that happens?

  • #2
    I wish you could provide a sample of your data since it will help us to answer your questions easier.
    The areg and reg with i.id should give the identical results. However, it is possible that their results differ from each other because their computation procedures are different from each other (please check the econometric books for the details). For instance, I speculate that multicollinearity can be at least among the reasons that their results might differ.
    Please see the following simulation as a naive example.
    Code:
    clear all
    * Imagine we have 17 villages
    set obs 17
    set seed 1234
    gen village_id = _n
      label var village_id "village specific ID"
    * creating time constant village heterogeneity
    gen c = rnormal()
      label var c "time constant heterogeneity (village specific)"
    * creating panel data (years of observations)  
    expand 50
    bysort village_id: gen year=_n
      label var year "year of observation"
    * creating dummies for the villages  
    tabulate village_id, generate(village_d)
    * creating the independent variable (explanatory variable)
    gen  odf = village_id^2+c
      label var odf "explanatory variable X (with time constant and time varying components)"
    * creating the error term  
    gen u = 400*rnormal()+3*c
      label var u "error term (correlated with unobservables c)"
    * creating the dependent variable (outcome variable)  
    gen haz06 = odf + u
      label var y "outcome variable"
    * ordering data set  
    order  village_id year haz06 odf
    drop u c  
    * setting the panel
    xtset village_id year
    * checking the number of observations
    ssc install unique
    unique village_id
    * we have 17 unique villages and
    unique year
    * we have 50 years of observations
    * correlation table
    pwcorr odf haz06 village_d1-village_d17, star(0.05)
    * Now, we run the regressions:
    reg haz06 odf i.village_id
    areg haz06 odf, absorb(village_id)
    xtreg haz06 odf, fe
    As seen in the results, in the first regression, odf is not omitted but in the areg and xtreg, the odf is omitted because of collinearity.

    Added: Please also note that in your first regression, you have results for 15 villages and not 16, while you have 17 villages. This might indicate that there is an additional collinearity problem in your data. However, I speculate that this additional problem is not the main reason behind different results for the reg and areg.
    Last edited by Amin Sofla; 16 Aug 2018, 03:44.

    Comment


    • #3
      To add to Amin's helpful comment, you'll increase your chances of a helpful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data.

      The most likely reason you don't get a parameter on odf is that odf does not vary within villages so the dummy for each village explains all the variance that odf might have explained. In panel analysis terms, with fixed effects you can't estimate parameters on variables that do not vary within panels.

      Comment

      Working...
      X