# R/pareto.R In ssdtools: Species Sensitivity Distributions

#### Documented in dparetopparetoqparetorpareto

```#    Copyright 2015 Province of British Columbia
#
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#
#    Unless required by applicable law or agreed to in writing, software
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and

#' Pareto Distribution
#'
#' Density, distribution function, quantile function and random generation
#' for the Pareto distribution with parameters scale and shape.
#' The functions are wrappers on the equivalent VGAM functions.
#'
#' @param x,q	vector of quantiles.
#' @param p	vector of probabilities.
#' @param n	number of observations.
#' @param scale	alpha parameter.
#' @param shape k parameter.
#' @param log,log.p logical; if TRUE, probabilities p are given as log(p).
#' @param lower.tail	logical; if TRUE (default), probabilities are P[X <= x],otherwise, P[X > x].
#' @return
#' dpareto gives the density, ppareto gives the distribution function,
#' qpareto gives the quantile function, and rpareto generates random deviates.
#' @name pareto
#' @examples
#' x <- rpareto(1000,1,0.1)
#' hist(log(x),freq=FALSE,col='gray',border='white')
#' hist(x,freq=FALSE,col='gray',border='white')
NULL

#' @rdname pareto
#' @export
dpareto <- function(x, scale = 1, shape, log = FALSE){
if(!length(x)) return(numeric(0))
VGAM::dpareto(x, scale = scale, shape = shape, log = log)
}

#' @rdname pareto
#' @export
qpareto <- function(q, scale = 1, shape, lower.tail = TRUE, log.p = FALSE){
if(!length(q)) return(numeric(0))
VGAM::qpareto(q, scale = scale, shape = shape, lower.tail = lower.tail, log.p = log.p)
}

#' @rdname pareto
#' @export
ppareto <- function(p, scale = 1, shape, lower.tail = TRUE, log.p = FALSE){
if(!length(p)) return(numeric(0))
VGAM::ppareto(p, scale = scale, shape = shape, lower.tail = lower.tail, log.p = log.p)
}

#' @rdname pareto
#' @export
rpareto <- function(n, scale = 1, shape){
VGAM::rpareto(n, scale = scale, shape = shape)
}
```

## Try the ssdtools package in your browser

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

ssdtools documentation built on May 2, 2019, 5:45 a.m.