0
I’m trying to realize the Plot half-normal chart for a mixed effects model adjusted through function lme
package nlme
.
Dice: https://drive.google.com/file/d/1Qtp3x3l-3U4p0dJfErDK0fHC0U2OM7Tq/view?usp=sharing
Below is the computational routine, verifying the error obtained.
library(nlme)
library(ggplot2)
library(hnp)
lmmNew3 <- lme(log(Var1)~log(Var2)+log(Var3)+
(Var4)+(Var5),
random = list(Var6=pdDiag(~Var7)), Data, method="REML")
Grap1=hnp(lmmNew3, xlab = 'Theoretical quantiles', ylab = 'Residuals',
main = '')
G1 <- with(Grap1, data.frame(x, lower, upper, median, residuals))
ggplot(data = G1, aes(x)) +
geom_point(aes(y = residuals)) +
geom_line(aes(y = lower)) +
geom_line(aes(y = upper)) +
geom_line(aes(y = median), linetype = "dashed") +
ylab("Residuals") +
xlab("Theoretical quantiles") +
theme(legend.title = element_text(size = 17),
legend.text = element_text(size = 17),
axis.text.x = element_text(size = 20,color = "black"),
axis.text.y = element_text(size = 20,color = "black"),
axis.title = element_text(size = 20),
axis.text = element_text(size = 25))
Error in hnp.default(lmmNew3, xlab = "Theoretical quantiles", ylab = "Residuals", :
This function has not been implemented for objects of class 'lme'. If you wish to supply your own fitting, simulation and diagnostic extration codes,
What does it mean
random = list(Var6=pdDiag(~Var7))
? Is random intercept effect for variableVar7
?– Guilherme Parreira