Hi all,
I am having a problem when predicting from the regression with pooled variables. By pooled variables I mean the ones that are created from the pool() function. I pooled the variable by groups (36 total), so putting the pooled variable in the regression automatically runs regression with indicators for 36 groups (some will be dropped due to collinearity). My current code is something like below:
# Create pooled data array from group_index column
sampledata[:group_pooled] = pool(sampledata[:group_index])
# Run regression
IPW_treat_fml = Formula(:attr_treat, :group_pooled)
IPW_treat_reg = glm(IPW_treat_fml, sampledata, Normal(), IdentityLink())
# Predict
predict(IPW_treat_reg, sampledata)
However, the predict(IPW_treat_reg, sampledata) does not work and gives me an error saying "DimensionMismatch("second dimension of A, 36, does not match length of x, 35"). If I write predict(IPW_treat_reg), then the code works, but I need to put sampledata in the prediction function in order to see all the NA predictions as well. predict(IPW_treat_reg) drops all the NA results.
Any help will be greatly appreciated!