dpareto {PtProcess} | R Documentation |
Density, cumulative probability, quantiles and random number generation for the Pareto and tapered Pareto distributions with shape parameter λ, tapering parameter theta and range a <= x < infty; and log-likelihood of the tapered Pareto distribution.
dpareto(x, lambda, a, log=FALSE) ppareto(q, lambda, a, lower.tail=TRUE, log.p=FALSE) qpareto(p, lambda, a, lower.tail=TRUE, log.p=FALSE) rpareto(n, lambda, a) dtappareto(x, lambda, theta, a, log=FALSE) ltappareto(data, lambda, theta, a) ptappareto(q, lambda, theta, a, lower.tail=TRUE, log.p=FALSE) qtappareto(p, lambda, theta, a, lower.tail=TRUE, log.p=FALSE, tol=1e-8) rtappareto(n, lambda, theta, a)
x, q |
vector of quantiles. |
p |
vector of probabilities. |
data |
vector of sample data. |
n |
number of observations to simulate. |
lambda |
shape parameter. |
theta |
tapering parameter. |
a |
the random variable takes values on the interval a <= x < infty. |
log, log.p |
logical; if TRUE , probabilities p are given as log(p) . |
lower.tail |
logical; if TRUE (default), probabilities are Pr{X <= x}, otherwise, Pr{X > x}. |
tol |
convergence criteria for the Newton Raphson algorithm for solving the quantiles of the tapered Pareto distribution. |
Let Y be an exponential random variable with parameter λ > 0. Then the distribution function of Y is
F_Y(y) = Pr{Y < y } = 1 - exp(-λ y),
and the density function is
f_Y(y) = λ exp(-λ y).
Further, the mean and variance of the distribution of Y is 1/λ and 1/λ^2, respectively.
Now transform Y as
X = a exp(Y),
where a>0. Then X is a Pareto random variable with shape parameter λ and distribution function
F_X(x) = Pr{X < x} = 1 - (a/x)^λ,
where a <= x < infty, and density function
f_X(x) = (λ/a) * (a/x)^(λ+1).
We simulate the Pareto deviates by generating exponential deviates, and then transforming as described above.
As above, let X be Pareto with shape parameter λ, and define W - a to be exponential with parameter 1/theta, i.e.
Pr{X > x} = (a/x)^λ
and
Pr{W > w} = exp[(a - w)/theta],
where a <= w < infty. Say we sample one independent value from each of the distributions X and W, then
Pr{X > z & W > z} = Pr{X > z} Pr{ W > z} = (a/z)^λ * exp[(a - z)/theta].
We say that Z has a tapered Pareto distribution if it has the above distribution, i.e.
F_Z(z) = Pr{Z < z} = 1 - (a/z)^λ * exp[(a - z)/theta].
The above relationship shows that a tapered Pareto deviate can be simulated by generating independent values of X and W, and then letting Z = min(X, W). This minimum has the effect of “tapering” the tail of the Pareto distribution.
The tapered Pareto variable Z has density
f_Z(z) = (λ/z + 1/theta) (a/z)^λ * exp[(a - z)/theta].
Given a sample of data z_1, z_2, ..., z_n, we write the log-likelihood as
log L = sum_{i=1}^n log f_Z(z_i).
Hence the gradients are calculated as
partial log L/partial λ = theta * sum{1/(λ*theta + z_i)} - sum{log(z_i/a)}
and
partial log L/partial theta = -1/theta * sum{z_i/(λ*theta + z_i)} - 1/theta^2 * sum{a - z_i}.
Further, the Hessian is calculated using
partial^2 log L/partial λ^2 = -theta^2 * sum{1/(λ*theta + z_i)^2},
partial^2 log L/partial theta^2 = 1/theta^2 * sum{z_i*(2*λ*theta + z_i)/(λ*theta + z_i)^2} + 2/theta^3 * sum{a - z_i},
and
partial^2 log L/(partial theta partial λ) = partial^2 log L/(partial λ partial theta) = sum{z_i/(λ*theta + z_i)^2}.
See the section “Seismological Context” (below), which outlines its application in Seismology.
dpareto
and dtappareto
give the densities; ppareto
and ptappareto
give the distribution functions; qpareto
and qtappareto
give the quantile functions; and rpareto
and rtappareto
generate random deviates.
ltappareto
returns the log-likelihood of a sample using the tapered Pareto distribution. It also calculates, using analytic expressions (see “Details”), the derivatives and Hessian which are attached to the log-likelihood value as the attributes "gradient"
and "hessian"
, respectively.
The Gutenberg-Richter (GR) Law says that if we plot the base 10 logarithm of the number of events with magnitude greater than M (vertical axis) against M (horizontal axis), there should be a straight line. This is equivalent to magnitudes having an exponential distribution.
Assume that the magnitude cutoff is M_0, and let Y = M - M_0. Given that Y has an exponential distribution with parameter λ, it follows that
log_10 (1 - F_Y(y)) = -λ/(log_e 10) * y.
The coefficient λ/(log_e 10) is often referred to as the b-value, and its negative value is the slope of the line in the GR plot.
Now define S as
S = 10^{gamma (M - M_0)} = 10^{gamma * Y}.
When gamma = 0.75, S is the “stress”; and when gamma = 1.5, S is the “seismic moment”. Still assuming that Y is exponential with parameter λ, then Y gamma log_e 10 is also exponential with parameter λ/(gamma log_e 10). Hence, by noting that S can be rewritten as
S = exp[ Y * gamma * log_e 10 ],
it is seen that S is Pareto with parameter λ/(gamma * log_e 10), and 1 <= S < infty.
While the empirical distribution of magnitudes appears to follow an exponential distribution for smaller events, it provides a poor approximation for larger events. This is because it is not physically possible to have events with magnitudes much greater than about 9.5. Consequently, the tail of the Pareto distribution will also be too long. Hence the tapered Pareto distribution provides a more realistic description.
See dexp
for the exponential distribution. Generalisations of the exponential distribution are the gamma distribution dgamma
and the Weibull distribution dweibull
.
See the topic distribution
for examples of estimating parameters.
# Simulate and plot histogram with density for Pareto Distribution a0 <- 2 lambda0 <- 2 x <- rpareto(1000, lambda=lambda0, a=a0) x0 <- seq(a0, max(x)+0.1, length=100) hist(x, freq=FALSE, breaks=x0, xlim=range(x0), main="Pareto Distribution") points(x0, dpareto(x0, lambda0, a0), type="l", col="red") #----------------------------------------------- # Calculate probabilities and quantiles for Pareto Distribution a0 <- 2 lambda0 <- 2 prob <- ppareto(seq(a0, 8), lambda0, a0) quan <- qpareto(prob, lambda0, a0) print(quan) #----------------------------------------------- # Simulate and plot histogram with density for tapered Pareto Distribution a0 <- 2 lambda0 <- 2 theta0 <- 3 x <- rtappareto(1000, lambda=lambda0, theta=theta0, a=a0) x0 <- seq(a0, max(x)+0.1, length=100) hist(x, freq=FALSE, breaks=x0, xlim=range(x0), main="Tapered Pareto Distribution") points(x0, dtappareto(x0, lambda0, theta0, a0), type="l", col="red") #----------------------------------------------- # Calculate probabilities and quantiles for tapered Pareto Distribution a0 <- 2 lambda0 <- 2 theta0 <- 3 prob <- ptappareto(seq(a0, 8), lambda0, theta0, a0) quan <- qtappareto(prob, lambda0, theta0, a0) print(quan) #----------------------------------------------- # Calculate log-likelihood for tapered Pareto Distribution # note the Hessian and gradient attributes a0 <- 2 lambda0 <- 2 theta0 <- 3 x <- rtappareto(1000, lambda=lambda0, theta=theta0, a=a0) LL <- ltappareto(x, lambda=lambda0, theta=theta0, a=a0) print(LL)