I'm running a segmented poisson glm (R version 4.1.0), but the output is giving me huge estimates and standard errors so I think something is wrong. I don't get any errors or warnings when I run the model. However, when I do a Davies' test on the segmented model, I do get an error. Code + error shown below.
library(segmented)
df <- structure(list(nspp = c(0L, 0L, 2L, 1L, 0L, 2L, 3L, 2L,
1L, 2L, 6L, 3L), date_num = 1:12), class = "data.frame", row.names = c(NA,
-12L))
glm <- glm(nspp ~ date_num, family="poisson", data=df)
seg_glm <- segmented(glm , seg.Z = ~date_num)
summary(seg_glm)
***Regression Model with Segmented Relationship(s)***
Call:
segmented.glm(obj = adv_nn_spp_m, seg.Z = ~date_num)
Estimated Break-Point(s):
Est. St.Err
psi1.date_num 2.097 50.665
Meaningful coefficients of the linear terms:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -430.2 21078.6 -0.020 0.984
date_num 205.1 13331.2 0.015 0.988
U1.date_num -205.0 13331.2 -0.015 NA
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 19.1048 on 11 degrees of freedom
Residual deviance: 7.5822 on 8 degrees of freedom
AIC: 39.678
Boot restarting based on 9 samples. Last fit:
Convergence attained in 0 iterations (rel. change 0.0000000033397)
You can see the estimates and standard errors are huge.
This is the warning message from the Davies' test:
davies.test(glm, seg.Z= ~date_num)
Warning message:
glm.fit: fitted rates numerically 0 occurred
Is this purely because I don't have much data? Or too many zeros? Any help appreciated!