1 |
x |
|
y |
|
pyhat |
|
pts |
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 | ##---- 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, pyhat = FALSE, pts = x)
{
m <- elimna(cbind(x, y))
x <- m[, 1]
y <- m[, 2]
n <- length(y)
sig <- sqrt(var(x))
temp <- idealf(x)
iqr <- (temp$qu - temp$ql)/1.34
A <- min(c(sig, iqr))
yhat <- NA
vval <- NA
vals <- NA
rhosq <- NA
for (k in 1:n) {
temp1 <- NA
for (j in 1:n) {
temp1[j] <- ((x[j] - x[k])/A)^2
}
epan <- ifelse(temp1 < 1, 0.75 * (1 - temp1), 0)
chkit <- sum(epan != 0)
if (chkit >= 2) {
temp4 <- lsfit(x, y, wt = epan)
vals[k] <- temp4$coef[2]
}
}
vals
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.