I am writing currently my thesis and I am stuck with a problem. I am trying to figure out how firm level, country level and industry level variables influence corporate social responsibility. I want to add Industry (SEC) and time fixed effects. But I can run the code only with one of them both. Actually the code should look like this, where the first part are country level specific variables and TA and LV are firm specific:
within <- plm(ESG ~ VOI_AC + Political.Stability + Government.effectiveness+ Regulatory.Quality +Rule.of.law + control.of.Corruption +Press.Freedom + pdi + idv + mas + uai + GI + HD + TA + LV, data=Neu1, index=c( "SEC", "year"), model="within")
I tried some trouble shooting like:
Neu1$year <- group_indices(Neu1, year, SEC.NAME)
and some combinations out of this. I know the problem is, that I have duplicate observations per Industry and year. But this is, because different firms will be in the same industry in one year. I can't get rid of the error:
duplicate couples (id-time) Zusätzlich: Warnmeldungen: 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[], index[]) : duplicate couples (id-time)
I am thankful for any help. I am a newcomer to R and I really read a lot to this problem, but I didn't find a workaround.