Reputation: 9793
library(nlme)
fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc),
data = Loblolly,
fixed = Asym + R0 + lrc ~ 1,
random = Asym ~ 1,
start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
I am fitting a nonlinear mixed effects model using the nlme
package in R. And I want to perform model diagnostics and check the assumptions that the 1) errors are normally distributed and that the 2) random effects are normally distributed.
For 1), I can just do a simple scatterplot of the residuals
qqnorm(fm1$residuals)
But how do I check that the random effects are also normally distributed?
Upvotes: 1
Views: 1746
Reputation: 73325
You can extract random effect by using generic function ranef
(or random.effects
). Particularly, the effect you want is
oo <- ranef(fm1)$Asym
Now you may use a QQ plot to check normality:
qqnorm(oo)
qqline(oo)
Upvotes: 2