1

I am trying to calculate simple slopes involving a 3-way interaction (apoe4:time:sleep_eff_10). See below

library(nlme)
m1  <-  lme(EF ~ sex_recoded + race_recoded + educ_year_centered + BMI_masterfile_centered + apoe4 + sleep_meds + CVD + CESD_withoutslp + baseline_age_masterfile_centered + baseline_age_masterfile_centered:time + time + sleep_eff_10c + time:apoe4 +  sleep_eff_10c:time + apoe4:sleep_eff_10c + apoe4:time:sleep_eff_10c, random = ~1|idno, 
            data = df2, method = "REML", na.action = na.omit)
summary(m1)

I am using the reghelper package to do this (see code below).

simple_slopes(m1, levels=list(apoe4=c(0, 1, 'sstest'),
                              time=c(0, 1, 2, 'sstest'), 
                              sleep_eff_10c=c(0.02, -4.67, 1.81, 'sstest')))

When I do this, I get the following error and warning message:

Error in summary(new_model)$tTable[dummy_names, ] : 
  subscript out of bounds
In addition: Warning message:
Using formula(x) is deprecated when x is a character vector of length > 1.
  Consider formula(paste(x, collapse = " ")) instead. 

I believe I am following the requirements of the package so I don't understand why I am getting these messages. Does anyone have any advice on getting this to work?

D. Fowler
  • 601
  • 3
  • 7

0 Answers0