Estou tentando realizar o grafico half-normal plot para um modelo de efeitos mistos ajustado por meio da função lme
do pacote nlme
.
Abaixo encontra-se a rotina computacional, verificando-se o erro obtido.
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,