R/UPopips.r

Defines functions UPopips

Documented in UPopips

UPopips<-function(lambda, type=c("pareto","uniform","exponential"))
{
if(any(is.na(lambda))) stop("there are missing values in the lambda vector")
n=sum(lambda)
if(!(type %in% c("pareto","uniform","exponential"))) stop("the type argument is wrong")
omega=runif(n)
switch(type,pareto=order(omega*(1-lambda)/((1-omega)*lambda))[1:n],
uniform=order(omega/lambda)[1:n], exponential=order(log(1-omega)/log(1-lambda)))[1:n]
}

Try the sampling package in your browser

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

sampling documentation built on Nov. 2, 2023, 6:26 p.m.