Hi everyone,
I have an issue while running command "random" in the package plm.
library(plm)
library(pwt9)
data("pwt9.1") #creating log of variables
lnrgdpo<- log(pwt9.1$rgdpo)
lnrkna<-log(pwt9.1$rkna)
lnhc<-log(pwt9.1$hc)
lnlabsh<-log(pwt9.1$labsh)
lnemp<-log(pwt9.1$emp)
ap<-(pwt9.1$rgdpo/pwt9.1$emp)
lnap<-log(ap)
pwtdata<-cbind(pwt9.1, lnrgdpo, lnrkna, lnhc, lnlabsh, lnemp, lnap)

penndata <- pdata.frame(pwtdata, index=c("country","year"))
Y <- cbind(lnrgdpo)
X <- cbind(lnrkna, lnhc, lnemp, lnemp, lnlabsh)

Random effects estimator

random <- plm(Y ~ X, data=penndata, model= "random")
swar <- plm(Y ~ X,
data = penndata, model="random", effect = "twoways")

while I run the command I receive the following error.
Error in solve.default(crossprod(ZBeta)) :
Lapack routine dgesv: system is exactly singular: U[5,5] = 0

I can't really approach your issue as your code seems either incomplete or doesn't represent what you did. Your model formula of Y ~ X doesn't match any variables in your data, so the code as written would be expected to error, even before it might be possible to complain about singularity