On 01/14/2013 05:19 PM, li li wrote:
Hi all,
I am trying to plot the one-sided confidence limits for the regression
line.
It seems it is ok to use predict function to compute the two sided
confidence
limits. Does any one know a easy way to compute the one sided confidence
limits?
Essentially just multiply the "lack of confidence" by 2.
E.g. for 95% one-sided confidence use 90% two-sided confidence
limits (and choose the limit that you're interested in).
E.g.:
set.seed(42)
x <- seq(0,10,length=101)
y <- 1.5 + 2.5*x + rnorm(101,0,5)
fit <- lm(y ~ x)
pfit <- predict(fit,interval="confidence",level=0.90)
plot(x,y)
lines(x,pfit[,"fit"])
lines(x,pfit[,"upr"],col="red")
You are then, for any given x value, 95% confident that the true mean of
"Y" lies *below* the
corresponding y-value on red curve that was plotted.
cheers,
Rolf Turner
______________________________________________
R-help@r-project.org 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.