R/d_2.R

"d_2" <-
function (n) 
{
    if ((length(n) > 1) || (mode(n) != "numeric")) {
        stop("Argument must be a scalar integer.")
    }
    if (n < 2) {
        approx <- NA
    }
    else {
        x <- 6 - ((seq(1, (6^(50/49)), length = 51)))^(49/50)
        x <- c(-x, rev(x[-1]))
        x.diff <- diff(x)
        x.101 <- x[-101] + diff(x)/2
        approx <- 2 * n * sum(dnorm(x.101) * x.101 * (pnorm(x.101)^(n - 
            1)) * x.diff)
    }
    approx
}

Try the CC package in your browser

Any scripts or data that you put into this service are public.

CC documentation built on Aug. 27, 2019, 9:02 a.m.