ancdet:

Usage Arguments Examples

Usage

1
ancdet(x1, y1, x2, y2, fr1 = 1, fr2 = 1, tr = 0.2, 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 = "+", ...)

Arguments

x1
y1
x2
y2
fr1
fr2
tr
alpha
plotit
plot.dif
pts
sm
pr
xout
outfun
MC
npts
p.crit
nreps
SEED
SCAT
xlab
ylab
pch1
pch2
...

Examples

 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
##---- 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, 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 (pr) 
        print("Note: critical values are based on the Studentized maximum modulus distribution")
    if (pr) 
        print("Confidence intervals are based on the adjusted critical p-value, p.crit")
    if (ncol(as.matrix(x1)) > 1) 
        stop("One covariate only is allowed with this function")
    if (is.null(p.crit)) 
        set.seed(2)
    xy = elimna(cbind(x1, y1))
    x1 = xy[, 1]
    y1 = xy[, 2]
    xy = elimna(cbind(x2, y2))
    x2 = xy[, 1]
    y2 = xy[, 2]
    if (xout) {
        flag <- outfun(x1, ...)$keep
        x1 <- x1[flag]
        y1 <- y1[flag]
        flag <- outfun(x2, ...)$keep
        x2 <- x2[flag]
        y2 <- y2[flag]
    }
    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, SEED = SEED)
    if (plot.dif) 
        plotit = FALSE
    res = ancova(x1, y1, x2, y2, fr1 = fr1, fr2 = fr2, tr = tr, 
        alpha = alpha, pr = FALSE, plotit = plotit, pts = pts, 
        SCAT = SCAT)$output
    critv = qnorm(1 - p.crit/2)
    res[, 7] = res[, 4] - critv * res[, 6]
    res[, 8] = res[, 4] + critv * res[, 6]
    if (plot.dif) {
        yhat = plot(c(res[, 1], res[, 1], res[, 1]), c(res[, 
            4], res[, 7], res[, 8]), type = "n", xlab = xlab, 
            ylab = ylab)
        critv = qnorm(1 - p.crit/2)
        z1 = lplot(res[, 1], res[, 4], plotit = FALSE, pyhat = T)$yhat
        z2 = lplot(res[, 1], res[, 7], plotit = FALSE, pyhat = T)$yhat
        z3 = lplot(res[, 1], res[, 8], 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[, 9] <= p.crit] = 1
    sig = as.matrix(sig)
    dimnames(sig) = list(NULL, "Sig.Dif")
    res = cbind(res, sig)
    list(output = res, num.sig = sum(sig), p.crit = p.crit)
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.