I want to use a DiD (Difference in differences) regression-based approach to measure the treatment effect based on two variables: tt1
(time and treatment dummy) on lexptot
(expenditure), using the plm
function in the plm
library:
reg5<-plm(formula=lexptot~tt1+treat98+year,data=d1,model="fd")
Based on the error message their is an issue with duplicates of id-time in my data frame:
1: In pdata.frame(data, index) :
duplicate couples (id-time) in resulting pdata.frame
to find out which, use e.g. table(index(your_pdataframe), useNA = "ifany")
2: In is.pbalanced.default(index[[1]], index[[2]]) :
duplicate couples (id-time)
How can I remove the duplicates?