Using geepack::geeglm with a Poisson family and identity link I’m asked to provide starting values. The documentation for the start, mustart and etastart parameters in this function refer to the glm documentation. So I was trying to use them as I would in glm. However, there seem to be differences between glm and geeglm causing some errors I could not understand.
Below is a simple reproducible example. Any ideas how to solve this?
library(geepack)
n ← 500
y= rbinom(n=500, size=1, prob=0.02)
x1 ← runif(n,0,100)
x2 ← runif(n,0,100)
x3 ← runif(n,0,100)
my_dat ← data.frame(y, x1, x2, x3)
glmfit1 ← glm(y ~ x1 + x2, data=my_dat, family=poisson(“log”)) # no problem
glmfit2 ← glm(y ~ x1 + x2, data=my_dat, family=poisson(“identity”)) # Error
Error: no valid set of coefficients has been found: please supply starting values
glmfit2 ← glm(y ~ x1 + x2, data=my_dat, family=poisson(“identity”), start=coef(glmfit1)) # Error
Error: cannot find valid starting values: please specify some
glmfit2 ← glm(y ~ x1 + x2, data=my_dat, family=poisson(“identity”), start=c(0.5,0.5,0.5)) # Working (though with warnings)
There were 15 warnings (use warnings() to see them)
Warning messages:
1: step size truncated: out of bounds
2: step size truncated: out of bounds
…
geefit1 ← geeglm(y ~ x1 + x2, data=my_dat, family=poisson(“log”), id=x3) #no problem
geefit2 ← geeglm(y ~ x1 + x2, data=my_dat, family=poisson(“identity”), id=x3) # Error
Error: no valid set of coefficients has been found: please supply starting values
geefit2 ← geeglm(y ~ x1 + x2, data=my_dat, family=poisson(“identity”), id=x3, start=c(0.5,0.5,0.5)) # Error and warnings
Error in model.frame.default(formula = y ~ x1 + x2, data = my_dat, start = c(0.5, :
variable lengths differ (found for ‘(start)’)
In addition: There were 15 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: step size truncated: out of bounds
2: step size truncated: out of bounds
…
Trying just to see what happens:
geefit ← geeglm(y ~ x1 + x2, data=my_dat, family=poisson(“identity”), id=x3, start=0.5) # Error
#Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, :