Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generalised linear mixed model error (binary response)

I am running a generalised linear mixed model in R for a binary response variable and I am getting an error message.

My code is:

library('lme4')
m1<-glmer(data=mydata, REPRODUCE~F1TREAT*SO+(1|LINE/MATERNAL_ID), family=binomial)

Where REPORDUCE = binary, F1TREAT and SO = factor each with 2 levels. This returns the warning:

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

However, the object 'm1' still appears in my Values list. Typing:

summary(m1)

returns the error:

Error in diag(vcov(object, use.hessian = use.hessian)) : 
  error in evaluating the argument 'x' in selecting a method for function 'diag':
Error in solve.default(h) : 
  Lapack routine dgesv: system is exactly singular: U[5,5] = 0

Does anyone have any idea what the issue is? Funnily, I can run the model just fine if I exclude the variable 'SO'.

Edit:

with(mydata,table(REPRODUCE,F1TREAT,SO))

, , SO = o

     F1TREAT
REPRODUCE control stress
    0      61    167
    1     125      8

, , SO = s

     F1TREAT
REPRODUCE control stress
    0       0      0
    1     186    172

The results of a glm are: Call: glm(formula = REPRODUCE ~ F1TREAT * SO, family = binomial, data = mydata)

Deviance Residuals: 
 Min        1Q    Median        3Q       Max  
-1.49323  -0.30592   0.00005   0.00005   2.48409  

Coefficients:
                   Estimate Std. Error z value Pr(>|z|)    
(Intercept)          0.7174     0.1562   4.594 4.36e-06 ***
F1TREATstress       -3.7560     0.3942  -9.529  < 2e-16 ***
SOs                 19.8486  1300.0538   0.015    0.988    
F1TREATstress:SOs    3.7560  1875.5931   0.002    0.998    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 898.27  on 718  degrees of freedom
Residual deviance: 300.37  on 715  degrees of freedom
AIC: 308.37

Number of Fisher Scoring iterations: 19
like image 643
Shannon Hodges Avatar asked Sep 23 '14 02:09

Shannon Hodges


People also ask

What are the assumptions of a GLMM?

(Generalized) Linear models make some strong assumptions concerning the data structure: Independance of each data points. Correct distribution of the residuals. Correct specification of the variance structure.

What is the difference between GLM and GLMM?

In statistics, a generalized linear mixed model (GLMM) is an extension to the generalized linear model (GLM) in which the linear predictor contains random effects in addition to the usual fixed effects. They also inherit from GLMs the idea of extending linear mixed models to non-normal data.

Is logistic regression A generalized linear mixed model?

Let's look at the basic structure of GLMs again, before studying a specific example of Poisson Regression. The logistic regression model is an example of a broad class of models known as generalized linear models (GLM). For example, GLMs also include linear regression, ANOVA, poisson regression, etc.

What is the difference between linear mixed model and generalized linear mixed model?

Linear mixed models assume your response (or dependent) variable is normally distributed. Generalized linear mixed models do not; instead you have to provide a suitable distribution and link function for your data.


1 Answers

with(mydata,table(REPRODUCE,F1TREAT,SO))

, , SO = o

     F1TREAT
REPRODUCE control stress
0      61    167
1     125      8

, , SO = s

     F1TREAT
REPRODUCE control stress
0       0      0
1     186    172

It's been suggested to me that my issue is caused by the fact that some combinations do not exist (complete separation). You can see that ALL of the plants in the 's' category flowered, therefore SO=s if perfectly precting REPRODUCE. If I change a couple of rows so that one one control s plant 'flowered' and one stress s plant 'flowered' then I am able to run the model and get the summary() output(albeit still with warning messages, probably due to partial separation). The non significance of SO in the glm is due to the Hauck-Donner phenomenon.

I am not sure what to do about this

like image 132
Shannon Hodges Avatar answered Oct 05 '22 15:10

Shannon Hodges