Error running jmv::anovaRM with a between-subj interaction

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
bsagarin
Posts: 2
Joined: Sun Nov 13, 2022 7:00 pm

Error running jmv::anovaRM with a between-subj interaction

Post by bsagarin »

I am trying to run a three-way mixed-model ANOVA with one within-subject variable and two between-subjects variables. The analysis runs correctly in JAMOVI using ANOVA-->Repeated Measures ANOVA, but when I try the syntax in R, I get an error:

Code: Select all

jmv::anovaRM(data = disgData,
  rm = list(list(label="disgustType", levels=c("moral","sexual","pathogen"))),
  rmCells = list(list(measure="moralDisgust",cell="moral"),
                 list(measure="sexualDisgust",cell="sexual"),
                 list(measure="pathogenDisgust",cell="pathogen")),
  bs = vars(instructions, gender),
  rmTerms = ~ disgustType,
  bsTerms = ~ instructions + gender + instructions:gender)
Error in if (term == "Residual") { : the condition has length > 1

The analysis runs without an error if I leave out the interaction term:

Code: Select all

jmv::anovaRM(data = disgData,
  rm = list(list(label="disgustType", levels=c("moral","sexual","pathogen"))),
  rmCells = list(list(measure="moralDisgust",cell="moral"),
                 list(measure="sexualDisgust",cell="sexual"),
                 list(measure="pathogenDisgust",cell="pathogen")),
  bs = vars(instructions, gender),
  rmTerms = ~ disgustType,
  bsTerms = ~ instructions + gender)
The code with the interaction ran correctly last year (I teach a graduate ANOVA class each fall, and I used the same demonstration last year).

I am using R version 4.2.2, R Studio version 2022.07.2 Build 576, and JAMOVI version 2.3.18.0. I did a fresh install of all three and the jmv package to confirm the error.

I've attached a copy of the dataset (from Lee, Ambler, & Sagarin, 2014, Archives of Sexual Behavior, Volume 43, pages 1115-1121). I loaded the dataset using:

Code: Select all

disgData <- read.csv("Disgust data.csv")
Thank you for your help!

- Brad
Attachments
Disgust data.csv
(4.2 KiB) Downloaded 112 times
User avatar
Ravi
Posts: 194
Joined: Sat Jan 28, 2017 11:18 am

Re: Error running jmv::anovaRM with a between-subj interacti

Post by Ravi »

Hi Brad,

Thank you for the bug report! I found out where the issue is and fixed it in this pull request: https://github.com/jamovi/jmv/pull/364. On my version of R (4.0.2) only a warning is given, so one of the later R versions probably promoted these types of issues to an error instead of a warning. Nonetheless, good to fix this.

You can already try this fix out by installing jmv through github:

Code: Select all

devtools::install_github("https://github.com/raviselker/jmv/tree/bugifx/fix-bug-that-gives-warning")
Please let us know whether this fixes your issue :)

Cheers,
Ravi
User avatar
Ravi
Posts: 194
Joined: Sat Jan 28, 2017 11:18 am

Re: Error running jmv::anovaRM with a between-subj interacti

Post by Ravi »

FYI, it looks like the promotion from warning to error happened in R 4.2.0. From the release notes:
Calling if() or while() with a condition of length greater than one gives an error rather than a warning...
bsagarin
Posts: 2
Joined: Sun Nov 13, 2022 7:00 pm

Re: Error running jmv::anovaRM with a between-subj interacti

Post by bsagarin »

Hi Ravi,

Thank you! The update fixed the issue! I will alert my students and have them install the update.

- Brad
Post Reply