ols.pred.ci:

Usage Arguments Examples

Usage

1
ols.pred.ci(x, y, xlab = "X", ylab = "Y", alpha = 0.05, xout = FALSE, RETURN = FALSE, newx = NULL)

Arguments

x
y
xlab
ylab
alpha
xout
RETURN
newx

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
##---- 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, xlab = "X", ylab = "Y", alpha = 0.05, xout = FALSE, 
    RETURN = FALSE, newx = NULL) 
{
    if (ncol(as.matrix(x)) != 1) 
        stop("One predictor is allowed")
    xy = elimna(cbind(x, y))
    x = xy[, 1]
    y = xy[, 2]
    if (xout) {
        flag = out(x)$keep
        x = x[flag]
        y = y[flag]
    }
    tmp.lm = lm(y ~ x)
    if (is.null(newx)) 
        newx = seq(min(x), max(x), 0.1)
    a = predict(tmp.lm, interval = "confidence", level = 1 - 
        alpha, newdata = data.frame(x = newx))
    plot(x, y, xlab = xlab, ylab = ylab)
    abline(ols(x, y, plotit = FALSE)$coef)
    lines(newx, a[, 2], lty = 2)
    lines(newx, a[, 3], lty = 2)
    res = NULL
    if (RETURN) 
        res = a
    res
  }

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