R Package segmented with an offset term
问题 I am using package segmented in R. I first fitted a Poisson glm with a log link function using the glm function that includes an offset term like: M1=glm(Y~X1+X2+X3+offset(log(X)),data=dat.1,family=poisson) M1 is fitted without any error. Next I tried to fit a segmented glm by using the package segmented in R as: library(segmented) seg.1=segmented(M1,seg.Z=~X1,psi=list(X1=c(0.5))) I am having the following error: Error in offset(log(X)) : object 'X' not found Where is my mistake here? Thanks