Home forums Mixed Models how to pass 'weights' to mixed()

Viewing 2 reply threads
  • Author
    Posts
    • #310
      S McIntyre
      Participant

      Hello,

      I have a mixed effects model with the following:
      pCorrect: dependent variable, a proportion
      nTotal: number of values used to compute pCorrect
      touchType: between subjects IV (fixed effect)
      cued: within subjects IV (fixed effect)
      exptPID: participant ID (random effect)

      The following works ok:

      > glmer(pCorrect ~ touchType + cued + (1 |exptPID), 
            weights=nTotal, family=binomial, data = touchCompare)

      but this gives me an error:

      > mixed(pCorrect ~ touchType + cued + (1 |exptPID), 
            weights=nTotal, family=binomial, data = touchCompare)
      
      Error in mixed(pCorrect ~ touchType + cued + (1 | exptPID), weights = nTotal,  : 
        object 'nTotal' not found

      But the help file for mixed says:

      … further arguments (such as weights/family) passed to lmer/glmer, such as control.

      So it seems that passing the weights argument should be supported. Am I doing something wrong?

    • #311
      henrik
      Keymaster

      Yeah, that should probably be better documented. You need to pass the whole vector:

      
      > mixed(pCorrect ~ touchType + cued + (1 |exptPID), 
            weights=touchCompare$nTotal, family=binomial, data = touchCompare)
      
    • #312
      S McIntyre
      Participant

      Thank you, that worked! And thanks for the quick reply.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.