Last active
October 3, 2021 19:31
-
-
Save MJacobs1985/0544b8be5593be6ca9e1781846a9ad86 to your computer and use it in GitHub Desktop.
NLMIXED in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Grass_new<-groupedData(y~x|Trial/Code, | |
data=Grass2, | |
FUN=mean, | |
labels=list(x="Time", y="DMres")) | |
try.nlm1<-nlme(y~U+D*exp(-(Kd*x)), | |
data=Grass_new, | |
fixed=U+D+Kd~1, | |
random=U+D~1|Trial/Code, | |
start=c(U=20,D=50.88,Kd=0.02698), | |
method="REML", | |
control=nlmeControl(maxIter=1000, msMaxIter = 100)) | |
summary(try.nlm1) | |
plot(augPred(try.nlm1, level=0:2)) | |
plot(try.nlm1) | |
plot(ranef(try.nlm1)) | |
fixef(try.nlm1) | |
qqnorm(try.nlm1) | |
anova(try.nlm1) | |
pairs(try.nlm1) # perfect correlations? | |
plot(Variogram(try.nlm1)) | |
fixed.effects((try.nlm1)) | |
random.effects(try.nlm1)[1] # random effect of Trial for U and D | |
random.effects(try.nlm1)[2] # random effect of Cow for U and D | |
plot(acf(resid(try.nlm1))) # for determining an MA aspect | |
plot(pacf(resid(try.nlm1))) # for determining an AR aspect | |
try.nlm4RE <- ranef(try.nlm1, aug = TRUE, level=1) | |
plot(try.nlm4RE, form = ~ Cow) | |
plot(try.nlm4RE, form = ~ Sample) | |
try.nlm4RE <- ranef(try.nlm1, aug = TRUE, level=2) | |
plot(try.nlm4RE, form = ~ Cow) | |
plot(try.nlm4RE, form = ~ Sample) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment