[R] negative predicted values in poisson glm

Adelchi Azzalini azzalini at stat.unipd.it
Wed Jan 18 17:23:32 CET 2006


On Wed, 18 Jan 2006 14:58:26 +0100, P. Olsson wrote:

PO> Dear  R  helpers,
PO> running the following code of a glm model of the family poisson,
PO> gives predicted values < 0. Why?
PO> 
PO> library(MASS)
PO> library(stats)
PO> library(mvtnorm)
PO> library(pscl)
PO> data(bioChemists)
PO> poisson_glm <-  glm(art ~ fem + mar + kid5 + phd + ment, data =
PO> bioChemists, family = poisson)
PO> predicted.values = predict(poisson_glm)
PO> range(predicted.values)
PO> 


use
 predicted.values = predict(poisson_glm, type="response")

best wishes,

Adelchi Azzalini  <azzalini at stat.unipd.it>
Dipart.Scienze Statistiche, Università di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/




More information about the R-help mailing list