1 | piplot(x, y, alpha = 0.05)
|
x |
|
y |
|
alpha |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y, alpha = 0.05)
{
x <- as.matrix(x)
p <- dim(x)[2] + 1
n <- length(y)
up <- 1:n
low <- up
out <- lsfit(x, y)
tem <- ls.diag(out)
lev <- tem$hat
res <- out$residuals
FIT <- y - res
Y <- y
corfac <- (1 + 15/n) * sqrt(n/(n - p))
val2 <- quantile(res, c(alpha/2, 1 - alpha/2))
for (i in 1:n) {
val <- sqrt(1 + lev[i])
val3 <- as.single(corfac * val2[1] * val)
val4 <- as.single(corfac * val2[2] * val)
up[i] <- FIT[i] + val4
low[i] <- FIT[i] + val3
}
zy <- c(min(low), Y, max(up))
zx <- c(min(FIT), FIT, max(FIT))
ff <- FIT
yy <- Y
Y <- zy
FIT <- zx
plot(FIT, Y, type = "n")
points(ff, yy)
abline(0, 1)
points(ff, up, pch = 17)
points(ff, low, pch = 17)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.