1

The dependent variable is a binary response of 1=correct, 0=incorrect. The fixed effect is language group ("English" or "Turkish"), and the random effect is participant. Whenever I try running the code it does not give a z-score or p-value for any of the effects.

This is what the data frame (named 'mixedSingle') looks like (maybe of importance is the fact that the groups of English vs Turkish are not equal in size):

Participant.Private.ID Participant.Starting.Group Correct
<int>                  <chr>                      <int>
7911618                English                      0       
7911618                English                      0       
7911618                English                      1   
... 
7993996                Turkish                      0       
7993996                Turkish                      1       
7993996                Turkish                      0   

I've tried using the following code (both with and without the final link=logit part):

model <- glmer(Correct ~ Participant.Starting.Group + (1|Participant.Private.ID), 
               data = mixedSingle, 
               family = binomial(link="logit"))

Trying to display the model within code gives the following output:

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: Correct ~ Participant.Starting.Group + (1 | Participant.Private.ID)
   Data: mixedSingle
      AIC       BIC    logLik  deviance  df.resid 
 985.0169  998.8206 -489.5085  979.0169       733 
Random effects:
 Groups                 Name        Std.Dev.
 Participant.Private.ID (Intercept) 0.5815  
Number of obs: 736, groups:  Participant.Private.ID, 23
Fixed Effects:
                      (Intercept)  Participant.Starting.GroupTurkish  
                           0.1031                             0.4892  
Warning messages:
1: In class(object) <- "environment" :
  Setting class(x) to "environment" sets attribute to NULL; result will no longer be an S4 object
2: In class(object) <- "environment" :
  Setting class(x) to "environment" sets attribute to NULL; result will no longer be an S4 object

I am unable to compare models from the same data with anova(model1,model2), giving the following error:

Error in anova.merMod(singleGLMER_English, singleGLMER) : 
models were not all fitted to the same size of dataset

If any one knows of anything that could help that'd be great!

  • 1
    The anova error, *"models were not all fitted to the same size of datas"* suggests that maybe your data has missing values in columns used in one model but not in the other. This would lead to those observations being dropped in one of the models, hence a different number of rows, resulting in models that can't be compared via ANOVA. I'd recommend dropping missing values from your data first, then fitting both models. You can set `na.action = na.fail` in your model code to make the model error rather than automatically drop NA values, thus ensuring your data clean was successful. – Gregor Thomas Feb 10 '23 at 03:18
  • 2
    As for no p-values, I believe that's a deliberate design choice for the `lme4` package. If you have a look at the [GLMM FAQ](https://bbolker.github.io/mixedmodels-misc/glmmFAQ#what-are-the-p-values-listed-by-summaryglmerfit-etc.-are-they-reliable) there's a section *"Why doesn’t lme4 display denominator degrees of freedom/p values? What other options do I have?"* – Gregor Thomas Feb 10 '23 at 03:21
  • 2
    @GregorThomas `summary.merMod` shows p-values for logistic GLMMs. OP just has to do `summary(model)`. – Roland Feb 10 '23 at 06:34
  • Ah yes, it has been a while since I did a GLMM in r, so I forgot summary(model) was required to fully display the data I was interested in. As for the missing values, I was trying to compare two different sets of data of different lengths, which was my problem. Now that these issues have been resolved my code works fine! – Aaron Holmberg Mar 01 '23 at 09:21

0 Answers0