#produces Figure 1 of Foster and Bravington (2009)
#fit RMC model to dataEG1
fm.est <- RMC.mod( states=dataEG1[,2], chain.id=dataEG1[,1], X=dataEG1[,3])
#calculate the simulation envelope (many fewer samples than Foster and Bravington (2009)
B<-50
temp.est <- diagnos.envel( obs.states=dataEG1[,2], chain.id=dataEG1[,1], X=dataEG1[,3,drop=FALSE], fit=fm.est, B=B)
#plot the patch residuals for the second state and the movement residuals
par(mfrow=c(1,2))
hrplot( temp.est[["patch"]][[2]], ylab="Patch Residuals - Normal Quantiles", xlab="Normal Quantiles", main="Stationary Data", pch=20)
hrplot( temp.est$movement, ylab="Movement Residuals - Normal Quantiles", xlab="Normal Quantiles", main="Stationary Data", pch=20)
Run the code above in your browser using DataLab