[R] plot confidence limits of a regression line - problem

David Winsemius dwinsemius at comcast.net
Sun Mar 8 02:42:42 CET 2009


It is not an error but rather a warning. As you should have seen, R  
went ahead and returned estimates for 24 predicted values for x1 for  
arguments to the formula of x2. In R errors and warnings are very  
different. You are expected to post full console messages to prevent  
this sort of confusion. In this case the warning puts you on notice  
that your offer to newdata= was not acceptable. You did not construct  
it with names that match those in the formula which was used to create  
model.

Please follow the links offered and read the Posting Guide:

-- 
David Winsemius


On Mar 7, 2009, at 8:18 PM, Martin Batholdy wrote:

> hi,
>
>
> I don't know what I am doing wrong,
>
> but with that code;
>
>
> x1 <- c(1.60, 0.27, 0.17, 1.63, 1.37, 2.00, 0.90, 1.07, 0.89, 0.43,
> 0.37, 0.59,
> 0.47, 1.83, 1.79, 0.90, 0.72, 1.83, 0.23, 1.97, 2.03, 2.19, 2.03,  
> 0.86)
>
> x2 <- c(1.30, 0.24, 0.20, 0.50, 1.33, 1.87, 1.30, 0.75, 1.07, 0.43,
> 0.37, 0.87,
> 1.40, 1.37, 1.63, 0.80, 0.57, 1.60, 0.39, 2.03, 1.90, 2.07, 1.93,  
> 0.93)
>
> model <- lm(x1 ~ x2)
>
> predict(model, newdata=data.frame(x=seq(0,4)), ,interval =
> c("confidence"), level = 0.90,type="response")
>
>
>
>
> I get an error message saying "newdate has four lines, but the
> variable found has 24"
>
>
> what is wrong in the code?
>
>
> thanks!
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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