rung3dlchk:

Usage Arguments Examples

Usage

1
rung3dlchk(x, y, est = onestep, regfun = tsreg, beta = 0.2, plotit = FALSE, nmin = 0, fr = NA, ...)

Arguments

x
y
est
regfun
beta
plotit
nmin
fr
...

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
66
67
68
69
70
71
##---- 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, est = onestep, regfun = tsreg, beta = 0.2, plotit = FALSE, 
    nmin = 0, fr = NA, ...) 
{
    if (!is.matrix(x)) 
        stop("Data are not stored in a matrix.")
    plotit <- as.logical(plotit)
    chkcor <- 1
    frtry <- c(0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.05, 1.1, 
        1.15, 1.2)
    if (!is.na(fr[1])) 
        frtry <- fr
    chkit <- 0
    for (it in 1:length(frtry)) {
        fr <- frtry[it]
        rmd <- runm3ds1(x, y, fr, tr, FALSE, nmin)
        xm <- y[!is.na(rmd)]
        rmd <- rmd[!is.na(rmd)]
        dif <- xm - rmd
        chkcor[it] <- pbvar(dif, beta)
    }
    if (sum(is.na(chkcor)) == length(chkcor)) {
        stop("A value for the span cannot be determined with these data.")
    }
    tempc <- sort(chkcor)
    chkcor[is.na(chkcor)] <- tempc[length(tempc)]
    temp <- order(chkcor)
    fr1 <- frtry[temp[1]]
    fr2 <- fr1
    val1 <- min(chkcor)
    chkcor2 <- 0
    if (is.na(fr)) {
        if (temp[1] == 1) {
            frtry <- c(0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 
                0.55, 0.6, 0.65, 0.7, 0.75)
            for (it in 1:length(frtry)) {
                fr <- frtry[it]
                rmd <- runm3ds1(x, y, fr, tr, FALSE, nmin)
                xm <- y[!is.na(rmd)]
                rmd <- rmd[!is.na(rmd)]
                dif <- xm - rmd
                chkcor2[it] <- pbvar(dif, beta)
            }
            tempc <- sort(chkcor2)
            chkcor2[is.na(chkcor2)] <- tempc[length(tempc)]
            print(chkcor2)
            temp2 <- order(chkcor2)
            fr2 <- frtry[temp2[1]]
        }
    }
    sortc <- sort(chkcor2)
    chkcor2[is.na(chkcor2)] <- sortc[length(sortc)]
    val2 <- min(chkcor2)
    fr <- fr1
    if (val2 < val1) 
        fr <- fr2
    rmd <- runm3d(x, y, fr = fr, tr, plotit = FALSE, nmin, pyhat = TRUE, 
        pr = FALSE)
    xm <- y[!is.na(rmd)]
    rmd <- rmd[!is.na(rmd)]
    etasq <- pbcor(rmd, xm)$cor^2
    temp <- y - regfun(x, y)$res
    pbc <- pbcor(temp, y)$cor^2
    temp <- (etasq - pbc)/(1 - pbc)
    list(gamma.L = temp, pbcorsq = pbc, etasq = etasq, fr = fr, 
        rmd = rmd, yused = xm, varval = chkcor)
  }

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