1

In a mixed model design, I changed the random covariance structure to diagonal:

library(sjPlot)
library(nlme)
model<- lme(fixed= DV~ IV1*IV2+ IV3 + IV4 + IV5,
control=list(opt="nlminb"), data=data,
                   random = list(id=pdDiag(~1+IV1*IV2)),
                   na.action=na.omit) 

When I try to use plot_model from the package "sjPlot" with this model:

plot_model(model,type="pred",terms=c("V1","V2"),mdrt.values="meansd")

It writes the error:

Error in gregexpr(pattern = "\\|", re)[[1]] : subscript out of bounds

here is a data sample:

set.seed(42)  
n <- 90
data <- data.frame ( id = rep(1:6, each = 15), 
                  DV=rnorm(n),
                  IV1=rnorm(n),
                  IV2=rnorm(n),
                  IV3=rnorm(n),
                  IV4=rnorm(n),
                  IV5=rnorm(n)
                  )

Would be grateful for an answer

Elad
  • 33
  • 6
  • 1
    If you edit your question to be more consistent with [the guidelines](https://stackoverflow.com/help/how-to-ask) (ie, provide reproducible data) you will get much faster, better help. – jpsmith Dec 14 '22 at 10:53
  • Thank you! I don't know how to create proper data since I use a pretty big data set, can you please help me with some tips? – Elad Dec 14 '22 at 10:57
  • 1
    The answer to [this question](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) is quite comprehensive and specific to R, specifically the section titled "Providing a minimal dataset" – jpsmith Dec 14 '22 at 10:59
  • fixed that - would be happy for help – Elad Dec 15 '22 at 21:10

0 Answers0