1 | lplotPV(x, y, span = 0.75, xout = FALSE, pr = TRUE, outfun = out, nboot = 1000, SEED = TRUE, plotit = TRUE, pyhat = FALSE, expand = 0.5, low.span = 2/3, varfun = pbvar, cor.op = FALSE, cor.fun = pbcor, scale = FALSE, xlab = "X", ylab = "Y", zlab = "", theta = 50, phi = 25, family = "gaussian", duplicate = "error", pc = "*", ticktype = "simple", ...)
|
x |
|
y |
|
span |
|
xout |
|
pr |
|
outfun |
|
nboot |
|
SEED |
|
plotit |
|
pyhat |
|
expand |
|
low.span |
|
varfun |
|
cor.op |
|
cor.fun |
|
scale |
|
xlab |
|
ylab |
|
zlab |
|
theta |
|
phi |
|
family |
|
duplicate |
|
pc |
|
ticktype |
|
... |
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 | ##---- 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, y, span = 0.75, xout = FALSE, pr = TRUE, outfun = out,
nboot = 1000, SEED = TRUE, plotit = TRUE, pyhat = FALSE,
expand = 0.5, low.span = 2/3, varfun = pbvar, cor.op = FALSE,
cor.fun = pbcor, scale = FALSE, xlab = "X", ylab = "Y", zlab = "",
theta = 50, phi = 25, family = "gaussian", duplicate = "error",
pc = "*", ticktype = "simple", ...)
{
if (SEED)
set.seed(2)
x = as.matrix(x)
if (ncol(x) == 2 && !scale) {
if (pr) {
print("scale=F is specified.")
print("If there is dependence, might use scale=T")
}
}
vals = NA
nv = ncol(x)
m = elimna(cbind(x, y))
x <- m[, 1:nv]
y <- m[, nv + 1]
if (xout) {
flag <- outfun(x, plotit = FALSE, ...)$keep
m <- m[flag, ]
x <- m[, 1:nv]
y <- m[, nv + 1]
}
x = as.matrix(x)
est = lplot(x, y, span = span, plotit = plotit, pr = FALSE,
pyhat = pyhat, outfun = outfun, expand = expand, low.span = low.span,
varfun = varfun, cor.op = cor.op, cor.fun = cor.fun,
scale = scale, xlab = xlab, ylab = ylab, zlab = zlab,
theta = theta, phi = phi, family = family, duplicate = duplicate,
pc = pc, ticktype = ticktype, ...)
n = nrow(x)
data1 <- matrix(sample(n, size = n * nboot, replace = TRUE),
nrow = nboot)
data2 <- matrix(sample(n, size = n * nboot, replace = TRUE),
nrow = nboot)
for (i in 1:nboot) {
vals[i] = lplot(x[data1[i, ], ], y[data2[i, ]], plotit = FALSE,
pr = FALSE)$Strength.Assoc
}
p = mean(est$Strength < vals)
list(p.value = p, Strength.Assoc = est$Strength.Assoc, Explanatory.power = est$Explanatory.power,
yhat.values = est$yhat.values)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.