Announcement

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

  • "Insufficient Observations" error with random effects model

    I have a minor technical inquiry on how to deal with "insufficient observations" with random effects model in panel setup. The details are provided below.



    I am working with multiple countries, multiple commodities and multiple year panel (trade) data (with repeated observations) in each case. I have also a single dependent variable in each case and multiple explanatory variables as I have shown below in the loop. I am running a Hausman test with sigmamore option using this loop. While I am able to run the fixed effects model estimates at commodity level alright, the random effects model shows an error — "insufficient observations".

    I am dealing with country level data (reporter_code=360). And I have been able to generate fixed effects estimates using the following loop. However, the random effect has not been able to generate the estimates. Instead, I obtained the error —"insufficient observations".

    By examining the outputs from fixed effects model, I have established on average there are about 200 observations per commodity in majority of cases. I have also considered the number of explanatory variables just so that I have sufficient observations in each case. However, the random effects model is not working even when I considered one or two explanatory variables. It generates instead —"insufficient observations".

    I have isolated a single country trade data (as opposed to multiple country data) to mitigate the problem of missing data. I have also cleaned missing data at country and commodity level. I am running the regression country by country using the command as shown below in the loop.


    local econvars var1 var2 var3 var4 var5 var6 /*group of explanatory variables*/
    local geogvars var1 var2 var3 var4 /*group of explanatory variables*/
    local policyvars var1 var2 var3 var4 /*group of explanatory variables*/
    local RTAs var1 var2 var3 var4 /*group of explanatory variables*/
    local var1 var2 var3 var4 /*group of explanatory variables*/
    local var1 var2 /*group of explanatory variables*/
    local reporter_code = "360" /*country code*/


    foreach num of local reporter_code{ /*country level */
    foreach year of varlist periodI periodII periodIII { /*each period represents eight years in each case*/
    foreach var of varlist comcode1-comcode24 comcode26-comcode64 comcode66{ /*comcode are dummies, total of 66*/
    di "reporter_code=`num'"
    di "year=`year'"
    di "commodity_code=`var'"
    capture noisily xtreg DependentVariable `econvars' `geogvars' `policyvars' `RTAs' `culturvars' IMR`var'_`year'_360 i.`year' c.fdiinflows#c.`var' if reporter_code==`num' & `year'==1 & `var'==1,fe
    estimates store fixed
    capture noisily xtreg DependentVariable `econvars' `geogvars' `policyvars' `RTAs' `culturvars' IMR`var'_`year'_360 i.`year' c.fdiinflows#c.`var' if reporter_code==`num' & `year'==1 & `var'==1,re
    estimates store random
    hausman fixed random,sigmamore

    }
    }
    }


    I would like your suggestions to address this problem.

  • #2
    Samuel:
    welcome to this forum.
    The first, non-technical suggestion is to re-post your query on the General forum, as this one is for practicing purposes only. Thanks.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment

    Working...
    X