0

Here's my dummy data

value<-c(0,1,1,1,0,0,0,0,0,1)
NDVI<-c(205,1981,1673,998,203,520,432,832,799,1023)
Rain<-c(350,200,120,110,174,138,185,129,128,200)
Temp<-c(12,10,8,9,21,22,31,29,27,9)
Location<-c("a","a","a","a","a","b","b","b","b","b")
Grid<-c(1,2,3,4,5,1,2,3,4,5)


value<-as.factor(data$value)
data<-data.frame(value,NDVI,Rain,Temp, Location, Grid)

data1 <- transform(data,
                   NDVI = drop(scale(NDVI)),
                   Rain = drop(scale(Rain)),
                   Temp = drop(scale(Temp)))

library(lme4)           
glmm1<-glmer(value~NDVI+Rain+Temp+(1|Location)+ (1|Grid), 
             family=binomial, data=data1)

summary(glmm1)

I don't know what I am doing wrong for it to give me such incorrect results. I have a large dataset and I tried doing glm as well with binomial error distribution, but something is not right and I cannot put my finger on it. I do get these warnings with glmm

**Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  unable to evaluate scaled gradient
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
   Hessian is numerically singular: parameters are not uniquely determined**

Please help me with understanding what I am doing wrong here. Am I supposed to put any additional step here?

Phil
  • 7,287
  • 3
  • 36
  • 66
  • You should supply a language tag to attract helpful views to your question. – pjs Aug 19 '23 at 19:07
  • Too few observations? See: https://stats.stackexchange.com/questions/187841/how-to-deal-with-clmm-warning-hessian-is-numerically-singular – I_O Aug 19 '23 at 20:45
  • This is just a dummy data as mentioned above, for everyone to know what I am running in the model. I want to know if the model building looks okay or if I am committing any mistakes there. I have more than 3000 observations and 18 species. Results of best model for all species are coming the same. Not sure what the issue is with the base model. – Zaara Kidwai Aug 19 '23 at 22:19
  • Should I change grid numbers for each location? – Zaara Kidwai Aug 19 '23 at 22:32
  • 1
    There is nothing obviously wrong with what you've showed us so far. It *might* help to see the results of `summary(data1)`. You said you tried a GLM (i.e., with `glm()`, dropping the random effects as well): what were the results? Ideally we could use a [mcve]: in a pinch, you could post a link to your data (if you're OK with it being publicly available ...) – Ben Bolker Aug 19 '23 at 23:42

0 Answers0