[R] Are fitted.values available in pglm?

Simon Berrebi @|mon @end|ng |rom berreb|@net
Fri Apr 12 04:46:19 CEST 2019


Hello everyone,

I am using the pglm function in R to fit a Poisson fixed-effects model. According to the documentation <https://cran.r-project.org/web/packages/pglm/pglm.pdf>, the pglm object should have fitted.values. However, fitted.values(mymodel) returns "NULL".

When I run AIC(mymodel) the AIC is followed by "attr(,"fitted.values")" and a long list of number. I have included an example below and attached a text file with the output.

Are these fitted values? If so, is there a way to obtain them directly? Can I also get fitted-values based on a synthetic dataset (i.e. predict())?

install.packages("pglm")
library(pglm)

data("PatentsRDUS", package="pglm")


     mymodel <- pglm(patents ~   log(rd)  + as.numeric(year)+ I(log(capital72)*as.numeric(year)) , PatentsRDUS,
     family = poisson(link=log), model = "within", index = c("cusip", "year"))

     fitted.values(mymodel)
     AIC(mymodel)

Cordially,
—
Dr. Simon J Berrebi
Postdoctoral Fellow 
Civil and Environmental Engineering
Georgia Institute of Technology










More information about the R-help mailing list