Hello,
I am a beginner using R studio for an introductory econometrics course. I am using the Ecdat data set which contains panel data, and I want to make a multiple regression and then use fixed effects for individuals and time. Whenever I try to use the fixed effects function of the plm package, I get the following error message:
Error in `row.names<-.data.frame`(`*tmp*`, value = c("X1.2", "X1.3", "X1.4", :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘X1’, ‘X1.1’, ‘X1.2’, ‘X1.3’, ‘X1.4’, ‘X1.5’, ‘X1.6’, ‘X2’, ‘X2.1’, ‘X2.2’, ‘X2.3’, ‘X2.4’, ‘X2.5’, ‘X2.6’, ‘X3’, ‘X3.1’, ‘X3.2’, ‘X3.3’, ‘X3.4’, ‘X3.5’, ‘X3.6’, ‘X4’, ‘X4.1’, ‘X4.2’, ‘X4.3’, ‘X4.4’, ‘X4.5’, ‘X4.6’, ‘X5’, ‘X5.1’, ‘X5.2’, ‘X5.3’, ‘X5.4’, ‘X5.5’, ‘X5.6’, ‘X6’, ‘X6.1’, ‘X6.2’, ‘X6.3’, ‘X6.4’, ‘X6.5’, ‘X6.6’, ‘X7’, ‘X7.1’, ‘X7.2’, ‘X7.3’, ‘X7.4’, ‘X7.5’, ‘X7.6’, ‘X8’
I looked around on different forums trying to find a way to make the values unique when setting the names of the rows, but I haven't had any success so far. Here's what I've done so far:
Wages <- plm.data(Wages, index = 595) #in order to get the id and time for the data from Ecdat
rownames(Wages) <- make.names(Wages[,1], unique = TRUE) #in order to try to make the row names unique
I've also created the following dummies:
allwage <- Wages$lwage
skin <- Wages$black
edu <- Wages$ed
years <- Wages$exp
Which I then tried to use with fixed effects in the following regression:
theFEline <- plm(allwage ~ skin, + edu + years, data = Wages, index = c("id","time"), model="within")
And that's when I got the error message.
I have a very limited idea of what I'm doing, and even less of an idea what to do next. Any help will be most appreciated.
Björn