Title: | Estimation of a Lognormal - Generalized Pareto Mixture |
Version: | 0.1.0 |
Description: | Estimation of a lognormal - Generalized Pareto mixture via the Expectation-Maximization algorithm. Computation of bootstrap standard errors is supported and performed via parallel computing. Functions for random number simulation and density evaluation are also available. For more details see Bee and Santi (2025) <doi:10.48550/arXiv.2505.22507>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Depends: | R (≥ 4.0.0) |
RdMacros: | Rdpack |
Imports: | evd, Rdpack, parallel, LNPar, EnvStats |
URL: | https://github.com/marco-bee/lognGPD |
BugReports: | https://github.com/marco-bee/lognGPD/issues |
NeedsCompilation: | no |
Packaged: | 2025-05-29 08:05:33 UTC; marco.bee |
Author: | Marco Bee |
Maintainer: | Marco Bee <marco.bee@unitn.it> |
Repository: | CRAN |
Date/Publication: | 2025-06-02 08:50:05 UTC |
Bootstrap standard errors for the MLEs of a lognormal-GPD mixture
Description
This function draws a bootstrap sample and uses it to estimate the parameters of a lognormal-Pareto mixture distribution. Since this is typically called by LPfitEM, see the help of LPfitEM for examples.
Usage
EMBoot(x, x0, y, maxiter)
Arguments
x |
list: sequence of integers 1,...,K, where K is the mumber of datasets. Set x = 1 in case of a single dataset. |
x0 |
numerical vector (5x1): initial values of the parameters p,
|
y |
numerical vector: observed sample. |
maxiter |
non-negative integer: maximum number of iterations of the EM algorithm. |
Details
At each bootstrap replication, the mixture is estimated via the EM algorithm.
Value
Estimated parameters obtained from a bootstrap sample.
Mixture estimation via EM
Description
This function estimates a static lognormal - generalized Pareto mixture by means of the EM algorithm. Optionally, bootstrap standard errors are computed via parallel computing.
Usage
EMlogngpdmix(x0, y, maxiter, nboot = 0)
Arguments
x0 |
numerical vector (5x1): initial values of the parameters p,
|
y |
vector: observed data. |
maxiter |
positive integer: maximum number of iterations of the EM algorithm. |
nboot |
positive integer: number of bootstrap replications for the computation of the standard errors (defaults to 0). |
Value
A list with the following elements is returned:
"p" = estimated value of p,
"post" = posterior probabilities of all observations,
"mu" = estimated value of \mu
,
"sigma " = estimated value of \sigma
,
"xi" = estimated value of \xi
,
"beta" = estimated value of \beta
,
"loglik" = maximimzed log-likelihood,
"nit" = number of iterations,
bootEst = matrix of parameter estimates at each bootstrap replications (only if nboot > 0).
bootStd = bootstrap standard errors of each parameter (only if nboot > 0).
Examples
y <- rlognGPD(100,.9,0,1,0.5,2)
x0 <- c(.7,.2,1.3,.8,1.7)
res <- EMlogngpdmix(x0, y, 1000)
Density of the lognormal-GPD mixture
Description
This function evaluates the lognormal-GPD mixture density function.
Usage
dlognGPD(x, p, mu, sigma, xi, beta)
Arguments
x |
vector (nx1): points where the function is evaluated. |
p |
real, 0<p<1: prior probability |
mu |
real: log-mean of the truncated lognormal distribution. |
sigma |
positive real: log-standard deviation of the truncated lognormal distribution. |
xi |
real: shape parameter of the generalized Pareto distribution. |
beta |
positive real: scale parameter of the generalized Pareto distribution. |
Value
ydens (n x 1) vector: numerical values of the lognormal - generalized Pareto mixture at x.
Examples
ydens <- dlognGPD(seq(0,20,length.out=500),.9,0,1,0.5,2)
Density of the lognormal-Pareto spliced distribution
Description
This function evaluates the density of the continuous and differentiable version of the truncated lognormal-Pareto spliced distribution proposed by Scollnik (2007).
Usage
dlognPareto(x, sigma, xmin, alpha)
Arguments
x |
vector (nx1): points where the function is evaluated. |
sigma |
positive real: log-standard deviation of the truncated lognormal distribution. |
xmin |
positive real: scale parameter of the Pareto distribution. |
alpha |
positive real: shape parameterof the Pareto distribution. |
Details
To get a continuous and differentiable density, it is necessary to enforce constraints that reduce the number of free parameters of the model; in particular, the mixing weight and the log-mean of the lognormal distirbution are functions of the reamining parameters. See Scollnik (2007) for details.
Value
ysim (n x 1) vector: numerical values of the truncated lognormal-Pareto spliced distribution at x.
References
Scollnik DPM (2007). “On composite lognormal-Pareto models.” Scandinavian Actuarial Journal, 1, 20-33.
Examples
ysim <- dlognPareto(seq(0,20,length.out=500),1,5,2)
Simulation of the lognormal-GPD mixture
Description
This function simulates a lognormal-GPD mixture.
Usage
rlognGPD(n, p, mu, sigma, xi, beta)
Arguments
n |
positive integer: number of observations sampled. |
p |
real, 0<p<1: prior probability |
mu |
real: log-mean of the lognormal distribution. |
sigma |
positive real: log-standard deviation of the lognormal distribution. |
xi |
real: shape parameter of the generalized Pareto distribution. |
beta |
positive real: scale parameter of the generalized Pareto distribution. |
Value
ysim (n x 1) vector: n random numbers from the lognormal - generalized Pareto mixture.
Examples
ysim <- rlognGPD(100,.9,0,1,0.5,2)
Simulation of the lognormal-Pareto spliced distribution
Description
This function simulates the continuous and differentiable version of the truncated lognormal-Pareto spliced distribution proposed by Scollnik (2007).
Usage
rlognPareto(n, sigma, xmin, alphapar)
Arguments
n |
positive integer: number of observations sampled. |
sigma |
positive real: log-standard deviation of the truncated lognormal distribution. |
xmin |
positive real: scale parameter of the Pareto distribution. |
alphapar |
positive real: shape parameterof the Pareto distribution. |
Details
See Scollnik (2007) for details.
Value
ysim (nreps x 1) vector: nreps random numbers from the truncated lognormal-Pareto spliced distribution.
References
Scollnik DPM (2007). “On composite lognormal-Pareto models.” Scandinavian Actuarial Journal, 1, 20-33.
Examples
ysim <- rlognPareto(100,1,5,2)
Weighted GPD log-likelihood
Description
This function evaluates the zero-mean generalized Pareto log-likelihood function computed with weighted observations.
Usage
weiGpdLik(x, y, post)
Arguments
x |
numerical vector (2x1): values of the parameters |
y |
numerical vector (nx1): observed data. |
post |
numerical vector (nx1) with elements in (0,1): weights of the observations (in the EM algorithm, posterior probabilities). |
Value
llik real: numerical value of the log-likelihood function
Examples
y <- rlognGPD(100,.9,0,1,0.5,2)
x0 <- c(.7,.2,1.3,.8,1.7)
res <- EMlogngpdmix(x0, y, 1000)
llik <- weiGpdLik(c(res$beta,res$xi),y,res$post)