I'd like to ask for help with the predict function. I want to get a fitting line to my data analog to abline(). For a different system I used this approach before.
mod1<-glm(data$Lengthmm ~ data$qbH.yr.med, family=quasipoisson,
subset = data$Age==1)
xv <- seq(min(data$qbH.yr.med), max(data$qbH.yr.med),
length.out = length(data$Lengthmm)) # poisson regression
yv <- predict(mod1 ~ data$qbH.yr.med, family=quasipoisson, list(x = xv))
Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "formula"
typeof(mod1)
# [1] "list"
typeof(xv)
# [1] "double"
class(mod1)
# [1] "glm" "lm"
class(xv)
# [1] "numeric"
I have no idea why it asks for the "formula" as non of my factors are of this class... I would by happy about help, or ideas for this error.