I am running a poisson regression with fixed effect. My individual fixed effects are city names in Chinese characters. However, pglm
cannot recognize them.
Below is my data set. Column city
represents cities in this panel data, whereas time
represents the time variable.
head(df)
# A tibble: 6 x 17
city time t maxt mint rain airp maxairp minairp rh minhumidity sun wind case1 ah case2 trend
<chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 安徽亳州 2020-01-24 5.05 7.95 3.3 0 10282. 10300. 10238. 85.5 74.5 0 25 3 5.83 3 0.75
2 安徽亳州 2020-01-25 5.05 7.4 3.3 0 10276 10302. 10255 64 44 5.5 31.5 2 4.36 2 1.75
3 安徽亳州 2020-01-26 2.25 5.35 0.6 82 10246 10272 10228. 83.5 48.5 0 27 0 4.72 0.5 2.75
4 安徽亳州 2020-01-27 1.85 3.6 0.65 20.5 10212. 10238. 10194. 91.5 80 0.5 17 2 5.04 2 3.75
5 安徽亳州 2020-01-28 2.35 8.5 -1.75 0 10201 10210 10188. 82.5 50 72 16.5 7 4.70 7 4.75
6 安徽亳州 2020-01-29 2.2 8.55 -1.75 0 10212. 10224. 10197 83.5 52.5 58 10.5 5 4.71 5 5.75
pglm
gave me errors like followed.
reg2 <- df %>% pdata.frame(index = c('city','time')) %>%
pglm(formula = case2 ~ t + rh + ah,
data = ., family = poisson, effect = 'twoways', model = 'within')
Error in pglm(formula = case2 ~ t + rh + ah, data = ., effect = "twoways", :
object '.' not found
Any ideas?