1 |
x |
|
y |
|
qval |
|
... |
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 40 41 42 43 | ##---- 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, qval = 0.5, ...)
{
x = as.matrix(x)
p <- ncol(x)
pp1 <- p + 1
yx <- elimna(cbind(y, x))
y <- yx[, 1]
x <- yx[, 2:pp1]
store.it = F
x <- as.matrix(x)
p.val <- NULL
crit.val <- NULL
x <- as.matrix(x)
n <- length(y)
x = standm(x)
gdot <- cbind(rep(1, n), x)
gdot <- ortho(gdot)
x <- gdot[, 2:pp1]
x <- as.matrix(x)
temp <- rqfit(x, y, qval = qval, res = T)
coef <- temp$coef
psi <- NA
psi <- ifelse(temp$residuals > 0, qval, qval - 1)
rnmat <- matrix(0, nrow = n, ncol = pp1)
ran.mat <- apply(x, 2, rank)
flagvec <- apply(ran.mat, 1, max)
for (j in 1:n) {
flag <- ifelse(flagvec <= flagvec[j], T, F)
flag <- as.numeric(flag)
rnmat[j, ] <- apply(flag * psi * gdot, 2, sum)
}
rnmat <- rnmat/sqrt(n)
temp <- matrix(0, pp1, pp1)
for (i in 1:n) temp <- temp + rnmat[i, ] %*% t(rnmat[i, ])
temp <- temp/n
test <- max(eigen(temp)$values)
test
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.