По моему мнению, код покачивания верен, но я не могу понять, почему он не работает. Какие-либо предложения? Я использую merTools версии 0.5.0 и Rstudio версии 1.2.5001
# These are sample data
CatAnx <- read.fwf(file=("http://www.stat.ufl.edu/~winner/data/cats_anxiety1.dat"),
widths=c(-6,2,-5,3,-5,3,-7,1,-7,1,-7,1,-7,1,-7,1,-6,2,-6,2,-6,2,-6,2,-6,2))
colnames(CatAnx) <- c('ID', 'Weight', 'Age_Months', 'Gender', 'Environment', 'Origin',
'Treatment', 'Result', 'EmoTime1', 'EmoTime2', 'EmoTime3', 'EmoTime4', 'EmoTime5')
library("reshape2")
CatAnxRM <- melt(CatAnx, id.vars=c("ID", "Gender", "Treatment"),
measure.vars=c("EmoTime1", "EmoTime2", "EmoTime3","EmoTime4", "EmoTime5"))
CatAnxRM$Sex <- with(CatAnxRM, ifelse(Gender==1, "Neut Female",
ifelse(Gender==2, "Neut Male", "Whole Female")))
CatAnxRM$Time <- with(CatAnxRM, ifelse(variable=="EmoTime1", 1,
ifelse(variable=="EmoTime2", 2, ifelse(variable=="EmoTime3", 3,
ifelse(variable=="EmoTime4", 4,5)))))
CatAnxRM.Male <- subset(CatAnxRM, Gender=="2")
# Run the model
library("lme4")
Male.lmer <- lmer(value ~ Treatment * Time + (Time + 1|ID), data=CatAnxRM.Male)
# Wiggle the data
library("merTools")
wiggle(Male.lmer, varlist = "Time", valueslist = CatAnxRM.Male$Time)
Ошибка при покачивании (Male.lmer, varlist = "Time", valueslist = CatAnxRM.Male $ Time): varlistи список значений должен быть равной длины.