尝试使用rand()函数时为什么会出现错误?

时间:2018-11-15 17:49:48

标签: r

我在R中使用rand函数时遇到麻烦。我不断收到错误,“ rand(model1)中的错误:找不到函数“ rand”。

这是我的代码:

library(lsmeans)
library(multcompView)
library(lmerTest)
library(lme4)
options(contrasts =c("contr.sum", "contr.poly"))

stores<-c(rep("1",8), rep("2",8), rep("3",8), rep("4",8))
display<-c("Yes","Yes","Yes","Yes","No","No","No","No","Yes","Yes","Yes","Yes","No","No","No","No","Yes","Yes","Yes","Yes","No","No","No","No","Yes","Yes","Yes","Yes","No","No","No","No")
week<-c("6","2","1","4","3","8","5","7","8","3","1","7","6","4","5","2","1","4","3","7","6","2","8","5","4","3","1","6","5","2","7","8")
sales<-c(956,953,938,1049,769,766,739,859,1008,1032,1025,1123,880,875,860,915,350,352,338,438,176,185,168,280,412,449,385,532,209,223,217,301)

df<-data.frame(stores=stores,display=display,week=week,sales=sales)
df

model1<-lmer(sqrt(sales)~display+(1|stores))
anova(model1)
resid=residuals(model1)
plot(model1)
qqnorm(resid)
qqline(resid)
rand(model1)

我不明白自己在做什么错

0 个答案:

没有答案