Skip to content
Prev 323742 / 398503 Next

zigzag confidence interval in a plot

Hello,

Try the following.


lmR <- lm(cd$Depth ~ cd$CHAOsep12RNA)
pconfR <- predict(lmR,interval="confidence")
pcR <- pconfR[order(pconfR[, 1]), ]  # Add this line

plot(cd$CHAOsep12RNA,cd$Depth, ylim = rev(range(0:100)), xlab="CHAO", 
ylab="Depth", pch=15, las=2, main="Sep12-RNA", cex.main=1)
abline(lmR)
matlines(sort(cd$CHAOsep12RNA), pcR[,c("lwr", "upr")], col=1, lty=2) # 
changed


Hope this helps,

Rui Barradas

Em 17-05-2013 14:03, Ozgul Inceoglu escreveu: