Random effects : Number of coefficients more then individuals 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?
 A: 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
