Ronnen Levinson wrote:
(I'm reposting this message because the original has not appeared after about 2 days. Sorry if it shows up twice.)


Hello.


First, thanks to those who responded to my recent inquiry about using contour() over arbitrary (x,y) by mentioning the interp() function in the akima package. That worked nicely. Now for a new question:

I would like to use a pair of prediction intervals to graphically bound the noise in some y(x) measurements. Here's an artificial example showing a function y(x)=x + noise, where the noise diminishes as x increases from 0 to 1.

x=seq(0,1,0.01) y=x+runif(length(x),-1,1)*((1-x)/5)
fit=lm(y ~ 1 + x)
pred=predict(fit, interval="prediction")
matplot(x,pred,type="l",ylab="y")
points(x,y)


I would have expected the lower and upper prediction intervals to converge as x increases (and the noise decreases), but they seem to remain virtually equidistant. Can anyone explain (a) the behavior that I see, and (b) how to obtain curves that do bound the noise?

Thanks,

Ronnen.



Well, since you use an "ordinary" lm(), for your residuals Var(e)=const. is assumed (among other assumptions), hence a global variance is also considered and estimated for prediction, of course:

 I(x_0) := x'_0 +- t_{n-h-1; 1-\alpha/2}
        \sqrt{s^2 (x'_0 (X'X)^{-1} x_0 + 1)}
              ^^^

You have to choose a completely different model.

Uwe Ligges

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to