1 | Dancdet(x1, y1, x2, y2, fr1 = 1, fr2 = 1, tr = 0.2, DIF = TRUE, alpha = 0.05, plotit = TRUE, plot.dif = FALSE, pts = NA, sm = FALSE, pr = TRUE, xout = FALSE, outfun = out, MC = FALSE, npts = 25, p.crit = NULL, nreps = 2000, SEED = TRUE, SCAT = TRUE, xlab = "X", ylab = "Y", pch1 = "*", pch2 = "+", ...)
|
x1 |
|
y1 |
|
x2 |
|
y2 |
|
fr1 |
|
fr2 |
|
tr |
|
DIF |
|
alpha |
|
plotit |
|
plot.dif |
|
pts |
|
sm |
|
pr |
|
xout |
|
outfun |
|
MC |
|
npts |
|
p.crit |
|
nreps |
|
SEED |
|
SCAT |
|
xlab |
|
ylab |
|
pch1 |
|
pch2 |
|
... |
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 | ##---- 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, x2, y2, fr1 = 1, fr2 = 1, tr = 0.2, DIF = TRUE,
alpha = 0.05, plotit = TRUE, plot.dif = FALSE, pts = NA,
sm = FALSE, pr = TRUE, xout = FALSE, outfun = out, MC = FALSE,
npts = 25, p.crit = NULL, nreps = 2000, SEED = TRUE, SCAT = TRUE,
xlab = "X", ylab = "Y", pch1 = "*", pch2 = "+", ...)
{
if (ncol(as.matrix(x1)) > 1)
stop("One covariate only is allowed with this function")
if (ncol(as.matrix(x1)) > 1)
stop("One covariate only is allowed with this function")
if (length(x1) != length(y1))
stop("x1 and y1 have different lengths")
if (length(x1) != length(x2))
stop("x1 and y2 have different lengths")
if (length(x2) != length(y2))
stop("x2 and y2 have different lengths")
if (length(y1) != length(y2))
stop("y1 and y2 have different lengths")
xy = elimna(cbind(x1, y1, x2, y2))
x1 = xy[, 1]
y1 = xy[, 2]
x2 = xy[, 3]
y2 = xy[, 4]
if (is.null(p.crit))
set.seed(2)
res1 = ancova(x1, y1, x2, y2, pr = FALSE, plotit = FALSE)$output
pts = seq(res1[1, 1], res1[5, 1], length.out = npts)
if (is.null(p.crit))
p.crit = ancdet.pv(length(y1), length(y2), nreps = nreps,
tr = tr, npts = npts, MC = MC)
if (plot.dif)
plotit = FALSE
res = Dancova(x1, y1, x2, y2, fr1 = fr1, fr2 = fr2, tr = tr,
alpha = p.crit, DIF = DIF, plotit = plotit, pts = pts,
SCAT = SCAT)$output
if (plot.dif) {
yhat = plot(c(res[, 1], res[, 1], res[, 1]), c(res[,
3], res[, 6], res[, 7]), type = "n", xlab = xlab,
ylab = ylab)
z1 = lplot(res[, 1], res[, 3], plotit = FALSE, pyhat = T)$yhat
z2 = lplot(res[, 1], res[, 6], plotit = FALSE, pyhat = T)$yhat
z3 = lplot(res[, 1], res[, 7], plotit = FALSE, pyhat = T)$yhat
lines(res[, 1], z1)
lines(res[, 1], z2, lty = 2)
lines(res[, 1], z3, lty = 2)
}
sig = rep(0, nrow(res))
sig[res[, 8] <= p.crit] = 1
sig = as.matrix(sig)
dimnames(sig) = list(NULL, "Sig.Dif")
res = cbind(res, sig)
list(p.crit = p.crit, output = res, num.sig = sum(sig), p.crit = p.crit)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.