[R] help with predict and plotting confidence intervals
David Winsemius
dwinsemius at comcast.net
Thu Mar 12 17:47:27 CET 2009
On Mar 12, 2009, at 11:45 AM, David Winsemius wrote:
>
> On Mar 12, 2009, at 11:14 AM, Michael Denslow wrote:
>
>>
>>
>> # I am not sure how to get the lines to draw correctly here
>> matlines(pred.frame$a,pp, lty=c(1,2,2),col="black")
>>
> The x values are your sequence whereas the y values are in the
> sequence from the original data. They are not correctly associated
> with each other.
>
> Try:
> pp <- predict(lm(wt.data$logS~wt.data$logA), int = "p", newdata=
> data.frame(logA=seq(0,6, length.out = 24)) )
> plot(pp)
>
At this point I should not have accepted your starting point. A better
starting point would be to use the wt.mod model:
pp <- predict(wt.mod, int = "p", newdata= list(logA=seq(0,6,
length.out = 24)) )
# Followed by:
plot( seq(0,6, length.out = 24), pp[ ,"fit"] )
lines(seq(0,6, length.out = 24), pp[ ,"lwr"], lty=2)
lines(seq(0,6, length.out = 24), pp[ ,"upr"], lty=2)
> --
> david winsemius
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list