I am trying to run a glmm for the first time with my data. I have population data across 13 study sites and I am using a test file to see the results for blesbok in South Africa. This is my code (totally made up)
library(glmm)
glmm1<-glmm(Number~Location,
random= list(~0+Nitrogen,~0+Dist_water),
varcomps.names=c("Nit","Dist"),
data = bles, m=100,
family.glmm = poisson.glmm)
Where,
Number <- c(25,16,16,13,12,9,15,5,4,5,1,259,224,259,588,604,483,576,599,664)
Location <- c("Borakolalo","Borakolalo","Borakolalo","Borakolalo","Bloemhof","Bloemhof","Bloemhof",
"Bloemhof","Boskop","Boskop","Boskop","Boskop","Kgaswane","Kgaswane","Kgaswane",
"Kgaswane","Mafikeng","Mafikeng","Mafikeng","Mafikeng")
Nitrogen<-c(1.0889,1.1406,0.9835,1.0737,1.0578,1.0806,0.9914,0.9630,1.1718,0.8955,1.0211,0.9489,
0.9808,1.0053,0.9682,0.9794,1.0959,1.0028,0.9281,0.9887)
Dist_water<- c(2156.0,3783.8,3285.8,2574.7,2242.3,1729.5,1018.1,1174.9,869.0,563.0,257.1,660.4,
840.4,717.7,762.6,528.5,626.5,691.2,635.9,606.5)
bles<-data.frame(Number,Location,Nitrogen,Dist_water)
I keep getting this error "Error in vars$family.glmm$checkData(y) : data must be nonnegative integers."
I don't understand how to fix it.
I also get these errors if I try to change anything in my random effects or Location. "Error in uniroot(fred, c(beta.dn, beta.up)) : invalid 'xmax' value"
OR "Error in trust(fn.inner.trust, parinit = c(beta, s), rinit = 5, rmax = 10000, : parinit not feasible"
OR Error in chol.default(thatthing) : the leading minor of order 2 is not positive definite
can someone please explain me these errors? I don't understand how to fix them. I would really appreciate the help.
I added "0" in front of Location
glmm1<-glmm(Number~0+Location, random= list(~0+Nitrogen,~0+Dist_water), varcomps.names=c("Nit","Dist"), data = bles, m=100,
your text family.glmm = poisson.glmm)
changed the Nitrogen value to whole numbers and got the error
Error in uniroot(fred, c(beta.dn, beta.up)) : invalid 'xmax' value