Reputation: 65
I have unbalanced panel data and I want to fit this type of regression:
Pr(y=1|xB) = G(xB+a)
where "y" is a binary variable, "x" vector of explanatory variables and "B" my coeff.
I want to implement random effect model with maximum likelihood estimation, however I didn't understand what I need to change in the plm
function (of package plm
) CRAN guide (vignette). As far I used this code:
library(plm)
p_finale <- plm.data(p_finale, index=c("idnumber","Year"))
attach(p_finale)
y <- (TotalDebt_dummy)
X_tot <- cbind(Size,ln_Age,liquidity,Asset_Tangibility,profitability,growth, sd_cf_risk1, family_dummy,family_manager,
sd_cf_risk1*family_dummy,
Ateco_A,Ateco_C,Ateco_D,Ateco_E,Ateco_F,Ateco_G,Ateco_H,Ateco_I,Ateco_J,Ateco_M,Ateco_N,
Ateco_Q,Ateco_R)
model1 <- plm(y~X_tot+factor(Year),data = p_finale, model="random")
I included the whole code, but the only thing I believe needs to be changed is the last row in plm
.
Upvotes: 0
Views: 646
Reputation: 3677
Function plm
from package plm
does not use a maximum-likelihood approach for model estimation. It uses a GLS approach as is common in econometrics.
Please see the section about plm versus nlme and lme4 in the package's first vignette ("Panel data econometrics with R: the plm package" (https://cran.rstudio.com/web/packages/plm/vignettes/A_plmPackage.html). The section explains the differences between the appraoches and has code examples for boths (and refers to packages nlme
and lme4
for the maximum-likelihood approach).
Upvotes: 1