I am attempting to perform an unbalanced panel data regression in R. My code is as follows:
pdata <- plm.data(b2, index = c("ticker", "year")) try1 <- plm(formula = logDipLoanTotal ~ PrimeFiling + logLiabBefore + logSalesBefore + EmplBefore + DebttoAssetRatio + squareDebttoAssetRatio + FSCashShortTermInvestments + Percent + NUM_OF_EMPLOYEES, data = pdata, model = "within", effect = "time") summary(try1)
I run into the following error:
duplicate couples (id-time) in resulting pdata.frame to find out which, use e.g. table(index(your_pdataframe), useNA = "ifany") duplicate couples (id-time)
This is obvious - I am having issues because my panel data is unbalanced, where the ticker/year combination can be associated with multiple lines of data. This is because multiple "deals" were done in the year associated with the company ticker in the year, or sometimes no deals were run in the ticker/year combination. How do I run this kind of model in RStudio with unbalanced data? Let me know if this doesn't make sense and I can edit the question.