Resolving cumulative family-related error

Here is my code and the error it generates(all variables have ordinal data measured on a 1-5 scale):

fit_WTA_CFC2 <-
  brm(
    WTA_MN ~ BT_MN + DT_MN + AT_MN + CFCpercpt_MN + SocInfl_MN + Complx_MN + Compt_MN,
    data = AttdnlData,
    family = cumulative(link = "probit", threshold = "flexible")
  )
Error: Family 'cumulative' requires either positive integers or ordered factors as responses.

I cannot figure out what this error means and how to overcome it.
Thanks.
Aruho

It looks like it’s saying that your outcome (response) variable is of the wrong type to use with family = cumulative. Based just on your code I don’t know what type of variable WTA_MN is, but according to the error message it needs to be coded as positive integers or alternatively as an ordered factor variable (apparently not just a regular factor but an ordered factor according to the error message).

Make sure that the 1 to 5 are literally numeric, and that there are no 0s. Also e.g., if there are NAs, that they are not in there like factors/characters such as “NA”. If you changed the 1 to 5 numbers to be factors, ensure that in the factor() function you also literally add ‘ordered = TRUE’, simply providing an order is not sufficient (which is a bit annoying!)

1 Like

Thank you JimBob.
Issue resolved - my data was reading as characters! I don’t know how that came to be, because other datasets imported in the same way were reading numeric.
I converted them to numeric, and that worked.
Thank you.

Aruho

2 Likes