1 |
x |
|
y |
|
n.iter |
|
sigmamu |
|
v |
|
beta |
|
... |
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ##---- 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 = NA, n.iter = 1, sigmamu = taulc, v = gkcov,
beta = 0.9, ...)
{
if (!is.na(y[1]))
x <- cbind(x, y)
if (!is.matrix(x))
stop("x should be a matrix")
x <- elimna(x)
n <- nrow(x)
p <- ncol(x)
val <- matrix(NA, p, p)
temp <- ogk(x, sigmamu = sigmamu, v = v, n.iter = n.iter,
beta = beta, ...)$cov
J = (p^2 - p)/2
p.values = matrix(NA, nrow = J, ncol = 3)
info = matrix(NA, nrow = J, ncol = 4)
dimnames(p.values) <- list(NULL, c("VAR", "VAR", "p.value"))
dimnames(info) <- list(NULL, c("VAR", "VAR", "COR", "Test.Stat"))
ic = 0
for (j in 1:p) {
for (k in 1:p) {
val[j, k] <- temp[j, k]/sqrt(temp[k, k] * temp[j,
j])
test.stat <- abs(val * sqrt((n - 2)/(1 - val^2)))
if (j < k) {
test = test.stat[j, k]
ic = ic + 1
p.values[ic, 1] = j
p.values[ic, 2] = k
info[ic, 1] = j
info[ic, 2] = k
info[ic, 3] = val[j, k]
info[ic, 4] = test
p.value = c("Greater than .1")
crit <- 4.8/n + 2.72
if (test >= crit)
p.value <- c("Less than .1")
crit <- 15.49/n + 2.68
if (test >= crit)
p.value <- c("Less than .05")
crit <- 14.22/n + 3.26
if (test >= crit)
p.value <- c("Less than .025")
crit <- 24.83/n + 3.74
if (test >= crit)
p.value <- c("Less than .01")
p.values[ic, 3] = p.value
}
}
}
list(cor = val, test.results = info, p.values = p.values)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.