Hello, I am running a negative binomial model using the glm.nb function from the MASS package. When I run the model the following error appears:
Error in if (any(y < 0)) stop("negative values not allowed for the 'Poisson' family") :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In model.response(mf, "numeric") :
using type = "numeric" with a factor response will be ignored
2: In Ops.factor(y, 0) : ‘<’ not meaningful for factors
My covariant of interest is numeric count data from 0-1900. I have converted this into numeric using the as.numeric function. My model looks like this:
model <- glm.nb(non_house_contact ~ wave, data = df)
I am not sure why this error is occurring. Any help would be appreciated. Thanks.
this code, has no apparent relation to 'df' which is the object passed to glb.nm in your example.
furthermore the str() if it is of df appears to show a different capitalisation Wave rather than wave etc, and R is case sensitive and will see these as different.
Hopefully these clues will be enough for you to progress.
If not, then you could get additional help by creating a more complete reprex, which you can read about how to do here