Pareto: The Pareto Distribution

Description Usage Arguments Details Value Examples

Description

Density, distribution function, distribution function derivatives, quantile function and random generation for the Pareto distribution function with shape shape and scale scale.

Usage

1
2
3
4
5
6
7
8
9
rpareto(n = 1, scale = 1, shape = 1)

ppareto(x, scale = 1, shape = 1)

dpareto(x, scale = 1, shape = 1)

Dpareto(x, d, scale = 1, shape = 1)

qpareto(p, scale = 1, shape = 1)

Arguments

n

Number of observations. If length(n) > 1, the length is taken to be the number required. Default value is 1

scale, shape

Positive real values respectively defining the shape and scale parameter of the Pareto distributon. Default value is 1 for both of them

x, q

Vector of quantiles

d

An non-negative integer giving the order of the derivative

p

vector of probabilities

Details

The Pareto distribution has the following cumultative distribution function

F(x) = 1 - (x/scale)^(-α)

for all x > scale

Value

dpareto gives the density, ppareto gives the distribution function, Dpareto gives the distribution function derivative, qpareto gives the quantile function, and rpareto generates random observations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Simulate a pareto sample
n <- 1e2 ; scale <- 1 ; shape <- 1
set.seed(100) ; X <- sort(rpareto(n, scale , shape))

# Compare the ECDF and the distribution function
plot(X, ecdf(X)(X))
lines(X,ppareto(X,shape,scale) , col = "red")

# Compare kernel density and density function
with(density(X, from = min(X)), plot(x, y))
lines(X,dpareto(X,shape,scale), col = "red")

# Visualize the distribution derivatives for 0 <= d <= 3
D <- 0:3

derivatives <- sapply(D, function(d) Dpareto(X,d,scale, shape))
dataPlot <- data.frame(
             x = rep(X,length(D)),
             y = c(derivatives),
             D = rep(paste0("d = ",D ), each = length(X))
             )

library(ggplot2)
ggplot(dataPlot, aes(x = x, y = y)) +
geom_line() +
facet_grid(D~., scales = "free_y")

cmottet/DistributionPty documentation built on May 13, 2019, 8:44 p.m.