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

This topic contains 2 replies, has 2 voices, and was last updated by  S McIntyre 1 year, 1 month ago.

  • Author
  • #310

    S McIntyre


    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


    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

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

You must be logged in to reply to this topic.