R/spkQuantile.R

Defines functions spkQuantile

Documented in spkQuantile

## function to determine empirical quantiles for the spikeins
spkQuantile <- function(amt, avgE, ens, p){
    obs <- as.vector(ens)
    N <- length(obs)
    M <- length(amt)
    q <- vector(length=M)
    out <- vector(length=2)
    for(i in 1:M){
        q[i] <- sum(obs<=avgE[i], na.rm=TRUE)/N
    }
    out[q <= p[1]] <- 1
    out[q <= p[2] & q > p[1]] <- 2
    out[q > p[2]] <- 3
    return(list(out=out, prop=q))
}

Try the spkTools package in your browser

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

spkTools documentation built on Nov. 8, 2020, 6:55 p.m.