1 |
x1 |
|
y1 |
|
y2 |
|
fr1 |
|
tr |
|
alpha |
|
plotit |
|
DISDIF |
|
DIF |
|
pts |
|
sm |
|
xout |
|
outfun |
|
nboot |
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | ##---- 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 (x1, y1, y2, fr1 = 1, tr = 0.2, alpha = 0.05, plotit = TRUE,
DISDIF = FALSE, DIF = TRUE, pts = NULL, sm = FALSE, xout = FALSE,
outfun = out, nboot = 500)
{
m = cbind(x1, y1, y2)
flag = is.na(x1)
m = m[!flag, ]
if (is.null(pts[1])) {
npt <- 5
isub <- c(1:5)
test <- c(1:5)
xorder <- order(x1)
y1 <- y1[xorder]
x1 <- x1[xorder]
y2 <- y2[xorder]
vecn <- 1
for (i in 1:length(x1)) vecn[i] <- length(y1[near(x1,
x1[i], fr1)])
sub <- c(1:length(x1))
isub[1] <- min(sub[vecn >= 12])
isub[5] <- max(sub[vecn >= 12])
isub[3] <- floor((isub[1] + isub[5])/2)
isub[2] <- floor((isub[1] + isub[3])/2)
isub[4] <- floor((isub[3] + isub[5])/2)
}
if (!is.null(pts[1]))
isub = c(1:length(pts))
mat <- matrix(NA, length(isub), 8)
dimnames(mat) <- list(NULL, c("X", "n", "DIF", "TEST", "se",
"ci.low", "ci.hi", "p.value"))
for (i in 1:length(isub)) {
if (is.null(pts)) {
ch = near(x1, x1[isub[i]], fr1)
mat[i, 1] = x1[isub[i]]
}
if (!is.null(pts)) {
ch = near(x1, pts[i], fr1)
mat[i, 1] = pts[i]
}
mat[i, 2] = sum(ch)
if (!DISDIF) {
if (!DIF) {
test <- yuend(m[ch, 2], m[ch, 3], tr = tr)
mat[i, 3] = mean(m[ch, 2], tr = tr) - mean(m[ch,
3], tr = tr)
mat[i, 4] <- test$teststat
mat[i, 5] <- test$se
mat[i, 6] <- test$ci[1]
mat[i, 7] <- test$ci[2]
mat[i, 8] <- test$siglevel
}
if (DIF) {
test = trimci(m[ch, 2] - m[ch, 3], tr = tr, pr = FALSE)
mat[i, 3] = mean(m[ch, 2] - m[ch, 3], tr = tr)
mat[i, 4] <- test$test.stat
mat[i, 5] <- test$se
mat[i, 6] <- test$ci[1]
mat[i, 7] <- test$ci[2]
mat[i, 8] <- test$p.value
}
}
if (DISDIF) {
test = l2drmci(m[ch, 2:3], pr = FALSE, nboot = nboot,
na.rm = na.rm)
mat[i, 3] <- loc2dif(m[ch, 2], m[ch, 3], na.rm = na.rm)
mat[i, 4] <- NA
mat[i, 5] <- NA
mat[i, 6] <- test$ci[1]
mat[i, 7] <- test$ci[2]
mat[i, 8] <- test$p.value
}
}
if (plotit)
runmean2g(x1, y1, x1, y2, fr = fr1, est = mean, tr = tr,
sm = sm, xout = xout, outfun = outfun)
list(output = mat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.