I want to run a fixed effect regression with net migration being the response and gini index a predictor. I add some control variables. The data is from WDI.
Because the response in the data set has negative values, I added the minimum value + 1 to make it positive in order for the poisson regression to work.
library(WDI)
data <- WDI(
country = c("AL", "AD", "AT", "BE", "BA", "HR", "EE", "FR", "GR", "IS",
"IT", "LI", "MC", "ME", "PT", "SK", "ES", "SE", "GB", "UA",
"BG", "CY", "DK", "FO", "FI", "DE", "IE", "XK", "LT", "LV",
"MT", "MD", "NL", "MK", "NO", "PL", "RO", "SM", "SI", "CH",
"TR", "RU", "BY"),
indicator = c(
"SI.POV.GINI", "SE.COM.DURS", "NY.GDP.PCAP.PP.KD","SL.UEM.TOTL.ZS","SP.POP.TOTL", "SM.POP.NETM"),
start = 2004,
end = 2024
)
write.csv2(data, "data.csv", row.names = FALSE)
data <- read.csv("data.csv", header = TRUE, sep = ";", dec = ",")
attach(data)
View(data)
dim(data)
names(data)
#clean data
data <- data[3:10]
dim(data)
data <- na.omit(data)
dim(data)
summary(data)
View(data)
data$SM.POP.NETM <- data$SM.POP.NETM + 261814
summary(data)
#FE, Poisson
library(pglm)
model1.FE = pglm(
SM.POP.NETM ~ SI.POV.GINI + SE.COM.DURS + NY.GDP.PCAP.PP.KD + SL.UEM.TOTL.ZS + SP.POP.TOTL,
data = data, family = poisson, model = "within"
)
summary(model1.FE)
The output seems wrong. If I specify a pglm random effect model I get some warnings.

data$SM.POP.NETM + 261814when in 2006 DEU (Germany) has-489056?