R/excursion_probability.R

Defines functions excursion_probability

Documented in excursion_probability

excursion_probability <- function(mn,sn,T){
  
  if(length(T)==1){
    # one thresholds
    pn <- pnorm( (mn - T)/sn )
  }else{
    # multiple thresholds
    T <- sort(T)
    k <- length(T)
    
    pn <- rep(0,times=length(mn))
    for(i in 1:k){
      Ti <- T[i]
      pn <- pn + (-1)^(i+1) * pnorm( (mn - Ti)/sn )
    }
  }
  return(pn)
  
}

Try the KrigInv package in your browser

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

KrigInv documentation built on Sept. 9, 2022, 5:08 p.m.