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