1 |
x1 |
|
y1 |
|
x2 |
|
y2 |
|
fr |
|
est |
|
xlab |
|
ylab |
|
SCAT |
|
sm |
|
nboot |
|
SEED |
|
eout |
|
xout |
|
outfun |
|
LP |
|
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ##---- 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, fr = 0.8, est = tmean, xlab = "X",
ylab = "Y", SCAT = TRUE, sm = FALSE, nboot = 40, SEED = TRUE,
eout = FALSE, xout = FALSE, outfun = out, LP = TRUE, pch1 = "*",
pch2 = "+", ...)
{
m <- elimna(cbind(x1, y1))
if (eout && xout)
stop("Not allowed to have eout=xout=T")
if (eout) {
flag <- outfun(m, plotit = FALSE)$keep
m <- m[flag, ]
}
x1 <- m[, 1]
y1 <- m[, 2]
if (xout) {
flag <- outfun(x1, ...)$keep
x1 <- x1[flag]
y1 <- y1[flag]
}
m <- elimna(cbind(x2, y2))
if (eout && xout)
stop("Not allowed to have eout=xout=T")
if (eout) {
flag <- outfun(m, plotit = FALSE)$keep
m <- m[flag, ]
}
x2 <- m[, 1]
y2 <- m[, 2]
if (xout) {
flag <- outfun(x2, ...)$keep
x2 <- x2[flag]
y2 <- y2[flag]
}
ord1 = order(x1)
x1 = x1[ord1]
y1 = y1[ord1]
ord2 = order(x2)
x2 = x2[ord2]
y2 = y2[ord2]
if (!sm) {
temp <- rungen(x1, y1, est = est, fr = fr, pyhat = TRUE,
plotit = FALSE, xout = FALSE, eout = FALSE, LP = LP,
...)
rmd1 <- temp[1]$output
}
if (sm) {
temp <- runmbo(x1, y1, est = est, fr = fr, pyhat = TRUE,
plotit = FALSE, SEED = SEED, nboot = nboot, eout = FALSE,
xout = FALSE, ...)
rmd1 <- temp
}
if (!sm) {
temp <- rungen(x2, y2, fr = fr, est = est, pyhat = TRUE,
plotit = FALSE, xout = FALSE, eout = FALSE, LP = LP,
...)
rmd2 <- temp[1]$output
}
if (sm) {
temp <- runmbo(x2, y2, est = est, fr = fr, pyhat = TRUE,
plotit = FALSE, SEED = SEED, nboot = nboot, eout = FALSE,
xout = FALSE, ...)
rmd2 <- temp
}
plot(c(x1, x2), c(y1, y2), type = "n", xlab = xlab, ylab = ylab)
sx1 <- sort(x1)
sx2 <- sort(x2)
xorder1 <- order(x1)
xorder2 <- order(x2)
sysm1 <- rmd1[xorder1]
sysm2 <- rmd2[xorder2]
if (LP) {
sysm1 = lplot(sx1, sysm1[xorder1], plotit = FALSE, pyhat = TRUE,
pr = FALSE)$yhat
sysm2 = lplot(sx2, sysm2, plotit = FALSE, pyhat = TRUE,
pr = FALSE)$yhat
}
if (SCAT)
points(x1, y1, pch = pch1)
if (!SCAT)
points(x1, y1, type = "n")
if (SCAT)
points(x2, y2, pch = pch2)
if (!SCAT)
points(x2, y2, type = "n")
lines(sx1, sysm1)
lines(sx2, sysm2, lty = 2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.