R/dbs.R

dbs <- function(x, N, S, log = FALSE){
	N[ !is.finite(N) | N <= 0] <- NaN
	S[ !is.finite(S) | S <= 0] <- NaN
  y <- (S-1)*(1-x/N)^(S-2)/N
	if (any(is.nan(y))) warning ("NaNs produced")
	y[ x < 0 | x > N] <- 0
	if(log) return (log(y))
	else return(y)
}

Try the sads package in your browser

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

sads documentation built on May 2, 2019, 1:56 p.m.