0

I'm trying to estimate a random effects model in R using the plm function. my data consists of financial and environmental variables for 6 banks from between the year 2012 and 2020. when i run the plm command, i get the following error:

> randomeff <- plm(roa ~ lnta + niita + nieta + eqas + crisk + lngdp + bmgr + infl,data = p.bank,model = "random")  

Error in swar_Between_check(estm[[2L]], method) : 
model not estimable: 9 coefficient(s) (incl. intercept) to be estimated for the between model but only 6 individual(s)

here is the dataset im using. the variables are : bank, year, return on asset, natural log of total assets, non interest income over total assets , non interest expense over total assets, equity or total assets, natural log of gdp, credit risk (loan loss provision over total loans), broad money growth rate and inflation rate. Any idea what the problem might be?

NoLifeKing
  • 39
  • 1
  • 7
  • Can you post a link to the data, or provide a lot more detail otherwise it is very difficult to diagnose – Robert Long Jun 20 '21 at 11:15
  • @RobertLong ok i will update the question. – NoLifeKing Jun 20 '21 at 11:44
  • edited the question – NoLifeKing Jun 20 '21 at 11:54
  • It seems that you are trying to estimate between-group fixed effects for 9 variables, but since you have only 6 groups, this will model will not be identified, so you either need more groups, or fewer between-group fixed effects. – Robert Long Jun 20 '21 at 12:41
  • that's what i initially thought but stata seems to run it just fine so now im confused – NoLifeKing Jun 21 '21 at 08:15
  • Then I dount they are fitting the same model. Do you get *identitical* results if you use 4 variables in both R and Stata ? – Robert Long Jun 21 '21 at 08:43
  • @RobertLong yes the results are the same when i run it using 4 variables. are there any other panel data packages i could try in case the problem is with the plm function? – NoLifeKing Jun 22 '21 at 07:34
  • Can you show your Stata code for the "full" model? Likely, it just drops some coefficients to make it estimable. You can also estimate some panel data models with gretl: http://gretl.sourceforge.net/ – Helix123 Jul 05 '21 at 12:00
  • No it outputs all the coefficients with the corresponding p values – NoLifeKing Jul 06 '21 at 16:35
  • Maybe Stata sets some to zero or leaves out the contribution of between model for some variable and takes only the within model contribution for those. I saw a similar case where Stata just estimates something but it is not what one thinks it is (what was requested), but the case was vice versa (within model not possible, between model possible), see here https://stats.stackexchange.com/a/470203/94889. – Helix123 Jul 07 '21 at 13:15

1 Answers1

3

The default random effects estimator, Swamy-Arora, makes use of the between model to estimate the variance components, meaning it needs to estimate the between model (and the within model).

Have a look what happens when you try to estimate the between model directly: covariates are dropped until the model becomes estimable (note the information in the summary output).

betweenmod <- plm(roa ~ lnta + niita + nieta + eqas + crisk +
                  lngdp + bmgr + infl, data = p.bank, model = "between")

summary(betweenmod)
## [...]
## Unbalanced Panel: n = 6, T = 7-8, N = 47
## Observations used in estimation: 6
## 
## Residuals:
## ALL 6 residuals are 0: no residual degrees of freedom!
## 
## Coefficients: (3 dropped because of singularities)
##              Estimate Std. Error t-value Pr(>|t|)
## (Intercept)  0.888811        NaN     NaN      NaN
## lnta        -0.045731        NaN     NaN      NaN
## niita        0.421913        NaN     NaN      NaN
## nieta       -2.206744        NaN     NaN      NaN
## eqas        -0.202324        NaN     NaN      NaN
## crisk       -2.201587        NaN     NaN      NaN
## [...]

For your data and model, the between model is not estimable, just as and why the error message says: too many covariates in your formula for the number of individuals in your data.

If you cannot gather more data (more individuals) and do not want to reduce your model (less covariates), you may want to try a different RE estimator like Wallace-Hussain, Amemiya, or Nerlove.

Use plm's argument random.method to choose the RE estimation method (default is "swar", other values are "walhus", "amemiya", and "nerlove"), e.g.:

randomwalhus <- plm(roa ~ lnta + niita + nieta + eqas + crisk + lngdp + bmgr + infl, data = p.bank, model = "random", random.method = "walhus")

One of the plm package's vignettes has introduction and examples and gives some background which models need to be estimated to derive the variance estimations: https://cran.rstudio.com/web/packages/plm/vignettes/B_plmFunction.html

Helix123
  • 1,265
  • 9
  • 15