Hi,
I'm using R to analyse a data set. I have found confidence intervals and prediction intervals for my data. However i'm having trouble adding the confience intervals and prediction intervals to my scatter graph.
x=c(-0.5,-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4,0.5)
y=c(8.1,7.8,8.5,9.8,9.5,8.9,8.6,10.2,9.3,9.2,10.5)
plot(x,y,pch=16,xlab="Temp",ylab="Sugar",main="Sug ar remaining after fermentation")
x0=data.frame(x=21.75)
ci=predict(pull.lm1,newdata=x0,interval="conf")
cbind(x0,ci)
pi=predict(pull.lm1,newdata=x0,interval="pred")
cbind(x0,pi)
lines(x0$x, ci[,2],lty=2);lines(x0$x,ci[,3],lty=2)
lines(x0$x, pi[,2],lty=3);lines(x0$x,pi[,3],lty=3)
The last two lines show my attempt at adding the confidence and prediction intervals. These commands arn't working, my graph stays the same. I'd appreciate any help. Thanks.


LinkBack URL
About LinkBacks