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