2
$\begingroup$

When I run a glm with binomial-family (logistic regression), R output gives me the logit-estimates, which can be transformed into probabilities using plogis(logit). So using something like plogis(predict(glm_fit, type = "terms")) would give me the adjusted probabilities of success for each predictor.

But what would be the equivalent for Poisson regression? How can I "predict" the adjusted incidents rates for each predictor?

Given this example:

set.seed(123)
dat <- data.frame(y = rpois(100, 1.5),
                  x1 = round(runif(n = 100, 30, 70)),
                  x2 = rbinom(100, size = 1, prob = .8),
                  x3 = round(abs(rnorm(n = 100, 10, 5))))

fit <- glm(y ~ x1 + x2 + x3, family = poisson(), data = dat)

and using predict.glm(fit, type = "terms")

I get:

         x1          x2          x3
1 -0.023487964  0.04701003  0.02563723
2  0.052058119 -0.20041119  0.02563723
3  0.003983339  0.04701003  0.01255701
4 -0.119637524  0.04701003 -0.03322376
5  0.010851165  0.04701003 -0.00706332
6 -0.105901873 -0.20041119 -0.00706332
...
attr(,"constant")
[1] 0.3786072

So, how many "incidents" (y-value) would I expect for each value of x1, holding x2 and x3 constant (what predict does, afaik)?

I'm not sure whether this question fits better into Stackoverflow or Cross Validated - please excuse if posting here was wrong!

$\endgroup$

2 Answers 2

2
$\begingroup$

Ok, I found a solution to this (see also my cross posting here: https://stackoverflow.com/a/36458038/2094622).

It's the inverse link-function family(fit)$linkinv(eta = ...), which gives me the correct predicted values / effects for different model families and link functions.

$\endgroup$
2
$\begingroup$

Since the canonical/default link for the Poisson family is log-transformation, the inverse link function is exp(). Try

predict(fit,type='response')

(this should work with any glm; the inverse-link function is built in) or simply

exp(predict(fit))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.