R/dfts.R

Defines functions dfts

Documented in dfts

dfts <-
function(x, sigma=1, lambda=1, dist="norm", log=FALSE)
{
if(!any(dist == c("norm", "logis", "cauchy", "laplace"))) 
            stop("distribution is not recognized")
#if(any(x<=0)) stop("x must be positive")
if(sigma<=0) stop("sigma must be positive")
g <- get(paste("d", dist, sep = ""), mode = "function")
G <- get(paste("p", dist, sep = ""), mode = "function")
lf <- -log(sigma)-G(lambda, log.p=TRUE)+g(x/sigma-lambda,log=TRUE)
if(!log) lf <- exp(lf)
lf
}

Try the tpn package in your browser

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

tpn documentation built on Sept. 28, 2023, 1:06 a.m.