I am running a fixed effects regression in R where the unit of analysis is the individual respondent. I want to implement region and Year fixed effects for the regression. I have used the within estimator in the plm function of package plm, but this does not work, because it rejects the regression, claiming there are duplicates. However, there are no duplicate units, the data are all individual respondents. It is not panel data, as respondents are only surveyed once, but plm wants c("ID", "Time"). My desired fixed effect is not unit-year, because the respondents are only surveyed once, it should be region, year. However, because there are multiple respondents within one region, this is rejected based on the alleged duplicates.
How can I add region-year fixed effects when my unit of analysis is below the region level.
Updating to add code for context:
My regression is as follows
regression <- plm(government ~ (sex + age + factor(education) + IV3)*incumbency + (sex + age + factor(education) + IV2)*incumbency + (sex + age + factor(education) + IV3)*incumbency, index = c("region", “year”), model = "within", data = data)
government is a continuous numerical measure of government satisfaction.
region is a categorical variable, and year is the date of the respondent interview
The individual units are respondents
IV1, IV2, and IV3 are all dummy variables for which group the individual respondent fits into (mutually exclusive)
incumbency is a dummy variable for whether the individuals’ preferred party is in power.
The data is not panel data, so there are multiple respondents within the region and year but they are unique respondents.
Because there are more than one respondent within each region for the same time I receive the following error:
Warning 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")
Error in pdim.default(index[[1L]], index[[2L]]) : duplicate couples (id-time)
There are no duplicates, however, as I have already run both the unique and distinct functions to remove them. I assume it is treating the individuals within the same region as duplicates, but they are not. I have used different settings (ie.effect = “twoways”) but this has not changed anything. How can I implement a region and year fixed effect for these, when there are multiple individuals within one region? (ie. regionis not the unit of analysis, the individual within the region is the unit of analysis)