r - Random effect glm in glmer error message -
this subset dataset trying run glm keeping in account random effect of operators taking more 1 measurements:
data<-data.frame(c("aa","ab","ac","ad","ae","af","ag","ab","ae","ah","ai","aj","ak","al","am","ad","an","ao","ap","aq","ar","as","at","au","aj","am","ai","ad","av","aw","ae","aa","ay","ap","am","az","ba","bb","bc","bd","be","bf","bg","bh","bi","bj","bk","bf","bl","ai","ad","bm","bn","bo","au","am","ae","ai","ac","bp","bq","br","bs","ab","bt","bu","bv","leh","ad","az","bw","bl","bx","by","bz","br","al","bu","aj","ca","cb","bo","bu","bo","cc","cd","bu","ce","cf","cg","ch","bo","ax","aj","ci","an","cj","bo","aj","ck","ay","cl","cm","cl","cn","av","co","bp","cp","ck","bp","bf","cq")) colnames(data)[1]<-"op" data$resp<-c(1,na,1,1,1,0,1,1,1,0,na,0,1,1,0,na,0,0,0,1,na,1,0,0,1,0,na,na,0,0,1,0,1,0,1,na,0,na,na,na,1,0,0,1,0,1,0,1,na,1,1,1,1,0,1,0,na,1,1,na,1,na,1,0,0,0,1,na,na,1,1,1,na,1,na,na,na,na,0,1,na,0,1,0,1,na,1,0,1,0,0,0,0,1,0,na,1,0,na,1,0,1,1,0,na,1,1,1,0,0,0,1,1) data$var1<-c(na,na,0,1,na,na,na,1,na,na,na,na,na,1,0,na,na,na,0,na,na,na,na,0,1,0,na,na,na,na,na,0,1,0,0,na,na,na,na,na,na,na,0,na,na,1,0,1,na,1,1,na,na,na,1,0,na,1,0,na,1,na,1,0,0,0,1,na,na,1,na,1,na,na,na,na,na,na,na,na,na,0,na,0,1,na,1,0,na,na,0,0,0,1,na,na,1,na,na,1,na,1,0,0,na,1,na,na,na,na,0,na,na) data$var2<-c(na,na,na,na,na,na,1,na,1,na,na,na,1,na,na,na,na,na,na,1,na,1,na,na,na,na,na,na,na,0,1,na,na,na,na,na,na,na,na,na,na,0,na,1,na,na,na,na,na,na,na,1,1,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,1,na,na,na,na,na,na,na,na,1,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,1,1,na,na,na,1,na) data$var3<-c(na,na,1,na,na,0,1,na,1,0,na,na,0,1,0,na,na,na,0,0,na,0,na,0,0,0,na,na,na,0,0,0,0,0,1,na,na,na,na,na,1,0,na,1,na,0,0,1,na,na,na,1,1,na,0,0,na,1,1,0,na,na,1,na,0,0,0,na,na,0,na,1,na,0,na,na,na,na,na,na,na,0,0,0,1,na,1,na,na,0,0,0,0,0,na,na,na,na,na,1,na,0,1,0,na,na,0,0,na,na,0,na,na) when run first glm using glmer (from lme4) follows:
summary(glmer(resp~var1+(1|op),data=data,family=binomial,na.action=na.omit)) i obtain error message
warning messages: 1: in checkconv(attr(opt, "derivs"), opt$par, ctrl = control$checkconv, : unable evaluate scaled gradient 2: in checkconv(attr(opt, "derivs"), opt$par, ctrl = control$checkconv, : hessian numerically singular: parameters not uniquely determined error in diag(vcov(object, use.hessian = use.hessian)) : error in evaluating argument 'x' in selecting method function 'diag': error in solve.default(h) : lapack routine dgesv: system singular: u[3,3] = 0 when run second glm second variable
summary(glmer(resp~var2+(1|op),data=data,family=binomial,na.action=na.omit)) i obtain other message:
error in summary(glmer(resp ~ var2 + (1 | op), data = data, family = binomial, : error in evaluating argument 'object' in selecting method function 'summary': error in summary(glmer(resp ~ var2 + (1 | op), data = data, family = binomial, : pwrssupdate did not converge in (maxit) iterations if run third variable
summary(glmer(resp~var3+(1|op),data=data,family=binomial,na.action=na.omit)) then seems work ok, true then? there must distribution of data analysis not working. has idea , can propose way around it?
i might have find way around running
summary(lme(resp~var1,random=~1|op,data=data,na.action=na.omit)) which seems run ok 3 variables, results little different data$var3 between glmer , lme , not trusting results @ point. not sure why getting these errors , explanations find in , other sites not make sense me. data simple why not working? using lme appropriate? many thanks
in case of second one, it's easy see regressions should fail (since predictor , outcome variables identical):
> na.omit(data[c('resp','var2','op')]) resp var2 op 7 1 1 ag 9 1 1 ae 13 1 1 ak 20 1 1 aq 22 1 1 30 0 0 aw 31 1 1 ae 42 0 0 bf 44 1 1 bh 52 1 1 bm 53 1 1 bn 74 1 1 83 1 1 bu 107 1 1 co 108 1 1 bp 112 1 1 bf in case of first 1 identical although there few cases (two think) different values structure imposed clustering term, it's not surprising me error message different.
in case of third one, there different problem:
> with( na.omit(data[c('resp','var3','op')]), table(resp,var3) ) var3 resp 0 1 0 22 0 1 16 18 this known "complete separation". when var3 1 there no cases of resp being equal 0. "true" odds of being 1 infinity. i'm guessing got coefficients of 10 or 20 (or in between). that's sign of pathological result logistic regression, because exponentiated coefficients (which odds ratios) extremely large. moral: should learn more tabular investigations before dive regression modeling.
Comments
Post a Comment