Calculating predicted values from the negative linear regression using PGLM




I have developed a fixed effect negative binomial model using PGLM package for panel data where my outcome variable is a count variable.
I am able to get the coefficients from the summary(model).

But there is no predict () for this package. SO i am not able to get the predicted values on a new data set.

Can anybody help me with any method to calculate the predicted outcomes manually using the coefficients.

I think i can’t directly use the coefficients to multiply with the values.

Any help will be highly appreciated as I need it urgently.

Thanks & Regards
Ashis Tripathy


Hi @Ashis

I want to make sure that I’ve understood your problem correctly. For this, I want to look at your code. Also, please share the output summary as well.

Let’s see if I can sort this out quickly.



Dear Manish,

Thanks for the prompt reply.

Due to confidentiality issue I can’t show you the code part.
My data contains various information variables for all the countries for the years 1960-2014. So it is in a panel data format. My output variable is a count variable which is a positive whole number for individual countries. So I went for a negative binomial regression on panel data. After some research I found a package “pglm” in R for similar task. But since the package is very new and only the first version is available, there is no predict() function to predict the output variable by applying the built model on a new data set containing the same variables for the year 2015 (except the output count variable value).
you can find the details about the package in the below link:

The format of my equation:

NB_Pan_Mod = pglm(Count ~ A + B+C +D ,data = train_pan
,family = negbin, model = “within”,index=c(‘Country’, ‘Year’))

But the following code does not work:
test_pan$Pred= predict(NB_Pan_Mod , test_pan ,type= “response”)

Hope this helps.

Please let me know if you need any more details.