1 |
x |
|
con |
|
op |
|
nboot |
|
plotit |
|
pyhat |
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 | ##---- 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, op = 4, nboot = 800, plotit = TRUE, pyhat = FALSE)
{
if (is.matrix(x))
x <- listm(x)
if (!is.list(x))
stop("Data must be stored in list mode or in matrix mode.")
J <- length(x)
if (J != length(con)) {
stop("Number of contrast coefficients must equal the number of groups")
}
for (j in 1:J) {
temp <- x[[j]]
temp <- temp[!is.na(temp)]
x[[j]] <- temp
}
flag <- (con < 0)
con1 <- con
con1[flag] <- 0
flag <- (con > 0)
con2 <- con
con2[flag] <- 0
bvec <- matrix(NA, nrow = J, ncol = nboot)
for (j in 1:J) {
data <- matrix(sample(x[[j]], size = nboot, replace = TRUE),
nrow = nboot)
bvec[j, ] <- data
}
bcon1 <- t(con1) %*% bvec
bcon2 <- t(con2) %*% bvec
bcon1 <- as.vector(bcon1)
bcon2 <- as.vector(bcon2)
fval <- g2plot(bcon1, bcon2, op = op, rval = 15, fr = 0.8,
aval = 0.5, xlab = "X", ylab = "")
fval
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.