Code for GLM Poisson regression (R):
The partial residuals for the k-th covariate in a GLM model:
Where r^W are the working residuals. So in my case:
Should be equal to:
Which is not. Why? What am I doing wrong or misunderstanding?
Code:
library(datasets) mydata <- warpbreaks
poisson_mod <- glm(breaks ~ wool + tension, mydata, family = poisson())
Gives:
Call: glm(formula = breaks ~ wool + tension, family = poisson(link = "log"),
data = mydata)
Coefficients:
(Intercept) woolB tensionM tensionH
3.6920 -0.2060 -0.3213 -0.5185
Degrees of Freedom: 53 Total (i.e. Null); 50 Residual
Null Deviance: 297.4
Residual Deviance: 210.4 AIC: 493.1

Where r^W are the working residuals. So in my case:
Code:
residuals(poisson_mod, type = 'partial')[1,1]
[1] -0.2490071
Code:
residuals(poisson_mod, type = 'working')[1] + exp(coef(poisson_mod)[1] + coef(poisson_mod)[2]*mydata$breaks[1])
-0.1625714