Title: | A Collection of Full Defined Distribution Tails |
---|---|
Description: | A full definition for Weibull tails and Full-Tails Gamma and tools for fitting these distributions to empirical tails. This package builds upon the papers by del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012) <doi: 10.1017/asb.2017.9> and Vilardell, Sergi & Serra, Isabel & Abella, Jaume & del Castillo, Joan & Cazorla, Francisco. (2019). Software Timing Analysis for Complex Hardware with Survivability and Risk Analysis. 227-236. <doi: 10.1109/ICCD46524.2019.00036>. This work has been supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. 772773). |
Authors: | Sergi Vilardell [aut, cre], Àlvar Pineda [aut] |
Maintainer: | Sergi Vilardell <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2025-03-07 03:33:13 UTC |
Source: | https://github.com/sergivilardell/disttails |
This function computes the density of the full-tail gamma with the input sample data. The expression for the density used is:
dFTG(x, threshold, scale, shape)
dFTG(x, threshold, scale, shape)
x |
Sample data. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the density of the FTG. The length of the result is determined by the length of x.
del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012). The full-tails gamma distribution applied to model extreme values. ASTIN Bulletin. <doi:10.1017/asb.2017.9>.
a <- 0.3 t <- 0.3 r <- 0.8 n <- 1000 sample <- rFTG(n, a, t, r) x <- seq(min(sample), max(sample), length.out = 200) d <- dFTG(x, a, t, r) hist(sample, breaks = "FD", probability = TRUE) lines(x, d, col = "red")
a <- 0.3 t <- 0.3 r <- 0.8 n <- 1000 sample <- rFTG(n, a, t, r) x <- seq(min(sample), max(sample), length.out = 200) d <- dFTG(x, a, t, r) hist(sample, breaks = "FD", probability = TRUE) lines(x, d, col = "red")
This function computes the density of the tailW with the input sample data. The expression for the density used is:
dtailw(x, threshold, scale, shape)
dtailw(x, threshold, scale, shape)
x |
Sample data. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the density of the TailW. The length of the result is determined by the length of x.
Vilardell, Sergi & Serra, Isabel & Abella, Jaume & del Castillo, Joan & Cazorla, Francisco. (2019). Software Timing Analysis for Complex Hardware with Survivability and Risk Analysis. 227-236. <doi:10.1109/ICCD46524.2019.00036>.
# Generate random deviates from a weibull tail and plot the theoretical density. scale <- 2 shape <- 1 threshold <- 1 x_seq <- seq(threshold, 5, length.out = 500) theo_density <- dtailw(x_seq, threshold = threshold, scale = scale, shape = shape) sample <- rtailw(500, threshold = threshold, scale = scale, shape = shape) hist(sample, probability = TRUE) lines(x = x_seq, y = theo_density, col = "red")
# Generate random deviates from a weibull tail and plot the theoretical density. scale <- 2 shape <- 1 threshold <- 1 x_seq <- seq(threshold, 5, length.out = 500) theo_density <- dtailw(x_seq, threshold = threshold, scale = scale, shape = shape) sample <- rtailw(500, threshold = threshold, scale = scale, shape = shape) hist(sample, probability = TRUE) lines(x = x_seq, y = theo_density, col = "red")
Maximum Likelihood Estimation of the tails by fitting a tailW or a FTG.
fittail(sample, dist = "TailW")
fittail(sample, dist = "TailW")
sample |
Sample data. |
dist |
Name of the distribution to fit. |
Gives a list of the estimated parameters fo the function fitted. For the TailW it returns, scale and shape. Fot the FTG it returns the parameters scale, shape, and threshold.
scale <- 2 shape <- 1 threshold <- 1 s <- rtailw(1000, threshold = threshold , scale = scale, shape = shape) fits <- fittail(s, dist = "TailW") x_seq <- seq(threshold, max(s), length.out = 500) theo_density <- dtailw(x_seq, threshold = threshold, scale = fits$scale, shape = fits$shape) hist(s, probability = TRUE, breaks = "FD") lines(x = x_seq, y = theo_density, col = "red")
scale <- 2 shape <- 1 threshold <- 1 s <- rtailw(1000, threshold = threshold , scale = scale, shape = shape) fits <- fittail(s, dist = "TailW") x_seq <- seq(threshold, max(s), length.out = 500) theo_density <- dtailw(x_seq, threshold = threshold, scale = fits$scale, shape = fits$shape) hist(s, probability = TRUE, breaks = "FD") lines(x = x_seq, y = theo_density, col = "red")
This function computes the loglikelihood of the full-tail gamma with the input sample data. The expression used is:
lFTG(x, threshold, scale, shape)
lFTG(x, threshold, scale, shape)
x |
Sample data. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the log-likelihood of the FTG. The length of the result is determined by the length of x.
del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012). The full-tails gamma distribution applied to model extreme values. ASTIN Bulletin. <doi:10.1017/asb.2017.9>.
lFTG(1,1,1,1)
lFTG(1,1,1,1)
This function computes the log-likelihood of the tailW with the input sample data.
ltailw(x, threshold, scale, shape)
ltailw(x, threshold, scale, shape)
x |
Sample data. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the log-likelihood of the TailW. The length of the result is determined by the length of x.
Vilardell, Sergi & Serra, Isabel & Abella, Jaume & del Castillo, Joan & Cazorla, Francisco. (2019). Software Timing Analysis for Complex Hardware with Survivability and Risk Analysis. 227-236. <doi:10.1109/ICCD46524.2019.00036>.
ltailw(1,1,1,1)
ltailw(1,1,1,1)
This function computes the probability of the full-tail gamma with the input sample data. The expression for the probability used is:
pFTG(x, threshold, scale, shape)
pFTG(x, threshold, scale, shape)
x |
Sample data. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the distribution function of the FTG. The length of the result is determined by the length of x.
del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012). The full-tails gamma distribution applied to model extreme values. ASTIN Bulletin. <doi:10.1017/asb.2017.9>.
pFTG(1,1,1,1)
pFTG(1,1,1,1)
This function computes the cumulative density function of the tailW with the input sample data.
ptailw(x, threshold, scale, shape)
ptailw(x, threshold, scale, shape)
x |
Sample data. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the distribution function of the TailW. The length of the result is determined by the length of x.
Vilardell, Sergi & Serra, Isabel & Abella, Jaume & del Castillo, Joan & Cazorla, Francisco. (2019). Software Timing Analysis for Complex Hardware with Survivability and Risk Analysis. 227-236. <doi:10.1109/ICCD46524.2019.00036>.
# Using the probability function to show the fitting. samp <- rtailw(1000, 1, 2, 3) emp_cdf <- ecdf(samp)(samp) pars <- fittail(samp, dist = "TailW") x_seq <- seq(min(samp), max(samp), length.out = 250) p <- ptailw(x_seq, threshold = 1, scale = pars$scale, shape = pars$shape) plot(samp, 1-emp_cdf, log = "y") lines(x_seq, 1-p, col = "red")
# Using the probability function to show the fitting. samp <- rtailw(1000, 1, 2, 3) emp_cdf <- ecdf(samp)(samp) pars <- fittail(samp, dist = "TailW") x_seq <- seq(min(samp), max(samp), length.out = 250) p <- ptailw(x_seq, threshold = 1, scale = pars$scale, shape = pars$shape) plot(samp, 1-emp_cdf, log = "y") lines(x_seq, 1-p, col = "red")
This function computes the quantiles of the full-tail gamma with the input sample data.
qFTG(p, threshold, scale, shape, interval)
qFTG(p, threshold, scale, shape, interval)
p |
Probability. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
interval |
a vector containing the end-points of the interval to be searched for the minimum. |
Gives the quantiles of the FTG. The length of the result is determined by the length of x.
del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012). The full-tails gamma distribution applied to model extreme values. ASTIN Bulletin. <doi:10.1017/asb.2017.9>.
qFTG(0.5,1,1,1, c(0,10))
qFTG(0.5,1,1,1, c(0,10))
This function computes the quantile function of the tailW.
qtailw(p, threshold, scale, shape)
qtailw(p, threshold, scale, shape)
p |
Probability. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives the quantiles of the TailW. The length of the result is determined by the length of x.
Vilardell, Sergi & Serra, Isabel & Abella, Jaume & del Castillo, Joan & Cazorla, Francisco. (2019). Software Timing Analysis for Complex Hardware with Survivability and Risk Analysis. 227-236. <doi:10.1109/ICCD46524.2019.00036>.
qtailw(0.5, 1, 1, 1)
qtailw(0.5, 1, 1, 1)
This function computes n random variates from full-tail gamma with a rejection method.
rFTG(n, threshold, scale, shape)
rFTG(n, threshold, scale, shape)
n |
Sample size. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives random deviates of the FTG. The length of the result is determined by n.
del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012). The full-tails gamma distribution applied to model extreme values. ASTIN Bulletin. <doi:10.1017/asb.2017.9>.
x <- rFTG(100, 1, 1, 1) hist(x, breaks = "FD")
x <- rFTG(100, 1, 1, 1) hist(x, breaks = "FD")
This function generates random deviates for the tailW distribution.
rtailw(n, threshold, scale, shape)
rtailw(n, threshold, scale, shape)
n |
Sample size. |
threshold |
Minimum value of the tail. |
scale |
Scale parameter. |
shape |
Shape parameter. |
Gives random deviates of the TailW. The length of the result is determined by n.
Vilardell, Sergi & Serra, Isabel & Abella, Jaume & del Castillo, Joan & Cazorla, Francisco. (2019). Software Timing Analysis for Complex Hardware with Survivability and Risk Analysis. 227-236. <doi:10.1109/ICCD46524.2019.00036>.
x <- rtailw(1000, 1, 2, 3) hist(x, breaks = "FD")
x <- rtailw(1000, 1, 2, 3) hist(x, breaks = "FD")