ycroissant / plm

Panel Data Econometrics with R
GNU General Public License v2.0
49 stars 13 forks source link

does pgmm support categorical variables? #53

Open palmierieugenio opened 4 months ago

palmierieugenio commented 4 months ago

I am trying to run a model like this (this is a minimal example with less variables), where A and B are categorical variables

fit<- pgmm(Y~lag(Y, 1)+lag(A, 1)+ B | lag(Y, 1:3) ,
                    data = dati_long_positive, 
                    index = c("id","year"),
                    model = "twostep",
                    effect="individual"
)

Are expressions like "+lag(A, 1)" or "+ B" supported if A and B are categorical variables? How are categorical variables handled in pgmm?

I have noticed that if I use A and B as a factor, my model does not run, while if I expand them in dummies with model.matrix it works, but I am not sure if it makes sense.