Dear R-list
Suppose I have a data set stored in hmet, for which I did get confidence
limit on a linear regression as shown below.
My question is how I can subset only data points which are within the
confidence limit.
Thank you.
Keun-Hyung
---------------------------------------------------------------
Al=rnorm(100, 3)
Cd=rnorm(100, 0.2)
hmet=data.frame(Al=Al, Cd=Cd)
plot(Al, Cd, xlab="Al", ylab= "Cd", , pch=16)
cd.lm=lm(Cd~ Al, na.action=na.omit, data= hmet)
abline(cd.lm$coeff, lty=1)
xy= data.frame (Al =pretty(hmet$Al, 20))
yhat=predict(cd.lm, newdata=xy, interval="confidence")
ci=data.frame(lower=yhat[,"lwr"], upper=yhat[,"upr"])
lines(xy$Al, ci$lower, lty= 2, lwd=2, col="grey")
lines(xy$Al, ci$upper, lty=2, lwd=2, col="grey")
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.