1 | lindep(x, con, cmat, alpha = 0.05, tr = 0.2)
|
x |
|
con |
|
cmat |
|
alpha |
|
tr |
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, con, cmat, alpha = 0.05, tr = 0.2)
{
if (is.matrix(x))
x <- listm(x)
if (!is.list(x))
stop("Data must be stored in a matrix or in list mode.")
con <- as.matrix(con)
J <- length(x)
w <- vector("numeric", J)
xbar <- vector("numeric", J)
for (j in 1:J) {
xbar[j] <- mean(x[[j]], tr = tr)
}
ncon <- ncol(con)
psihat <- matrix(0, ncol(con), 4)
dimnames(psihat) <- list(NULL, c("con.num", "psihat", "se",
"test"))
w <- cmat
for (d in 1:ncol(con)) {
psihat[d, 1] <- d
psihat[d, 2] <- sum(con[, d] * xbar)
cvec <- as.matrix(con[, d])
sejk <- sqrt(t(cvec) %*% w %*% cvec)
psihat[d, 3] <- sejk
psihat[d, 4] <- psihat[d, 2]/sejk
}
list(test.stat = psihat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.