1 |
x1 |
|
y1 |
|
x2 |
|
y2 |
|
xout |
|
outfun |
|
STAND |
|
alpha |
|
HC3 |
|
plotit |
|
xlab |
|
ylab |
|
... |
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 | ##---- 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, xout = FALSE, outfun = outpro, STAND = TRUE,
alpha = 5, HC3 = FALSE, plotit = TRUE, xlab = "X", ylab = "Y",
...)
{
p = ncol(as.matrix(x1))
if (p == 1 && plotit)
reg2plot(x1, y1, x2, y2, xlab = "X", ylab = "Y", xout = xout,
outfun = outpro, regfun = ols, ...)
x = list()
y = list()
x[[1]] = x1
x[[2]] = x2
y[[1]] = y1
y[[2]] = y2
ivl = c(1:ncol(as.matrix(x1)))
iv = ncol(as.matrix(x1))
iv1 = iv + 1
rlab = paste("slope", ivl)
rlab = c("intercept", rlab)
res = olsWmcp(x, y, xout = xout, outfun = outfun, STAND = STAND,
alpha = alpha, HC3 = HC3)
n = res$n
nk = res$n.keep
est1 = ols(x1, y1)$coef
est2 = ols(x2, y2)$coef
res = res$output[, 3:5]
outp = matrix(NA, nrow = iv1, ncol = 5)
outp[, 1] = est1
outp[, 2] = est2
outp[, 3:5] = res
dimnames(outp) = list(rlab, c("Est.Group.1", "Est.Group.2",
"ci.low", "ci.up", "p.value"))
list(n = n, n.keep = nk, output = outp)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.