Type: | Package |
Title: | Density Estimation by Extreme Value Distributions |
Version: | 1.2.3 |
Author: | Javaria Ahmad Khan, Atif Akbar. |
Maintainer: | Javaria Ahmad Khan <jakhan0@yahoo.com> |
Description: | Provides mean squared error (MSE) and plot the kernel densities related to extreme value distributions with their estimated values. By using Gumbel and Weibull Kernel. See Salha et al. (2014) <doi:10.4236/ojs.2014.48061> and Khan and Akbar (2021) <doi:10.4236/ojs.2021.112018 >. |
URL: | https://CRAN.R-project.org/package=DEEVD |
License: | GPL-2 |
Imports: | evd |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Depends: | R (≥ 2.10) |
NeedsCompilation: | no |
Packaged: | 2021-11-28 13:38:57 UTC; Javaria Ahamd Khan |
Repository: | CRAN |
Date/Publication: | 2021-11-28 13:50:02 UTC |
DEEVD
Description
Two extreme value distributions; Weibull and Gumbel kernel related functions are presented. Weibull
and Gumbel
present estimated values and plot.Weibull
and plot.Gumbel
plot the densities. While mean squared error can be calculated by using mse
. Further, some related data sets are also presented.
Details
Density Estimation by Extreme Value Distributions
Author(s)
Javaria Ahmad Khan, Atif Akbar.
References
Salha, R. B., El Shekh Ahmed, H. I., & Alhoubi, I. M. 2014. Hazard Rate Function Estimation Using Weibull Kernel. Open Journal of Statistics 4 (08), 650-661.
Khan, J. A., & Akbar, A. 2021. Density Estimation Using Gumbel Kernel Estimator. Open Journal of Statistics 11 (2), 319-328.
See Also
Useful links:
Estimate Density Values by Gumbel kernel
Description
The Gumbel kernel is developed by Khan and Akbar (2020). They provided evidence that performance of their proposed is better then Weibull kernel especially when data belongs to family of extreme distributions. Gumbel Kernel is
K_{Gumbel(x, \sqrt{h})}(j)=\frac{1}{\sqrt{h}}exp-\left( \frac{j-x}{\sqrt{h}} +exp\left( \frac{j-x}{\sqrt{h}}\right) \right)
Usage
Gumbel(x = NULL, y, k = NULL, h = NULL)
Arguments
x |
scheme for generating grid points |
y |
a numeric vector of positive values. |
k |
gird points |
h |
the bandwidth |
Details
In this function, choice of bandwidth, number of grid points and scheme that how these grid points are generated are user based. If any parameter(s) is missing then function used default parameters.
But at least x
or k
should be specified otherwise NA
will be produced. If x
is missing then function will generate k
grid points between minimum and maximum values of vector. Similarly, if
k
is missing then function consider it same to length of main vector. In case if h
is missing then function used normal scale rule bandwidth for non-normal data and described in Silverman (1986).
Value
x |
grid points |
y |
estimated values of density |
Author(s)
Javaria Ahmad Khan, Atif Akbar.
References
Khan, J. A., & Akbar, A. 2021. Density Estimation Using Gumbel Kernel Estimator. Open Journal of Statistics 11 (2), 319-328.
See Also
For other kernel see Weibull
. To plot the density by using Gumbel kernel plot.Gumbel
and to calculate MSE use mse
.
Examples
#Data can be simulated or real data
## Number of grid points "k" should be at least equal to the data size.
### If user define the generating scheme of gridpoints than number of gridpoints should
####be equal or greater than "k"
###### otherwise NA will be produced.
y <- rexp(100, 1)
xx <- seq(min(y) + 0.05, max(y), length = 100)
h <- 2
den <- Gumbel(x = xx, y = y, k = 200, h = h)
##If scheme for generating gridpoints is unknown
y <- rexp(50, 1)
h <- 3
den <- Gumbel(y = y, k = 90, h = h)
##If user do not mention the number of grid points
y <- rexp(23, 1)
xx <- seq(min(y) + 0.05, max(y), length = 90)
## Not run:
#any bandwidth can be used
require(KernSmooth)
h <- dpik(y) #Direct Plug-In Bandwidth
den <- Gumbel(x = xx, y = y, h = h)
## End(Not run)
#if bandwidth is missing
y <- rexp(100, 1)
xx <- seq(min(y) + 0.05, max(y), length = 100)
den <- Gumbel(x = xx, y = y, k = 90)
Flood discharge in per second from Mississippi river
Description
A dataset containing the flood discharge in per second in cubic meter from Mississippi river.
Usage
Mississippi
Format
A vector with 23 observations
References
Gumbel, E. J. 1941. The return period of flood flows. The Annals of Mathematical Statistics. 12, 163-190.
Flood discharge in per second from Rhone river
Description
A dataset containing the flood discharge in per second in cubic meter from Rhone river.
Usage
Rhone
Format
A vector with 23 observations
References
Gumbel, E. J. 1941. The return period of flood flows. The Annals of Mathematical Statistics. 12, 163-190.
Data of control patients of Suicide study
Description
A dataset which contains a length of treatment spells (in days) of control patients in suicide study.
Usage
Suicide
Format
A vector with 86 observations
References
Silverman, B. W. 1986. Density Estimation. Chapman & Hall/ CRC, London.
Estimated Density Values by Weibull kernel
Description
The Weibull kernel is developed by Salha et al. (2014). They used it to nonparametric estimation of the probability density function (pdf) and the hazard rate function for independent and identically distributed (iid) data. Weibull Kernel is
K_w\left( x, \frac{1}{h}\right)(t) =\frac{\Gamma(1+h)}{hx}\left[ \frac{t\Gamma(1+h)}{x}\right] ^{\frac{1}{h}-1} exp\left( -\left( \frac{t\Gamma(1+h)}{x}\right) ^\frac{1}{h}\right)
Usage
Weibull(x = NULL, y, k = NULL, h = NULL)
Arguments
x |
scheme for generating grid points |
y |
a numeric vector of positive values |
k |
number of gird points |
h |
the bandwidth |
Details
see the details in the Gumbel
Value
x |
grid points |
y |
estimated values of density |
Author(s)
Javaria Ahmad Khan, Atif Akbar.
References
Salha, R. B., El Shekh Ahmed, H. I., & Alhoubi, I. M. 2014. Hazard Rate Function Estimation Using Weibull Kernel. Open Journal of Statistics 4 (08), 650-661. Silverman, B. W. 1986. Density Estimation. Chapman & Hall/ CRC, London.
See Also
For Gumbel kernel see Gumbel
. To plot its density see plot.Weibull
and to calculate MSE mse
.
Examples
#Data can be simulated or real data
## Number of grid points "k" should be at least equal to the data size.
### If user define the generating scheme of gridpoints than number of gridpoints should
####be equal or greater than "k"
##### otherwise NA will be produced.
y <- rexp(100, 1)
xx <- seq(min(y) + 0.05, max(y), length = 100)
h <- 2
den <- Weibull(x = xx, y = y, k = 200, h = h)
##If scheme for generating gridpoints is unknown
y <- rexp(50, 1)
h <- 3
den <- Weibull(y = y, k = 90, h = h)
##If user do not mention the number of grid points
y <- rexp(23, 1)
xx <- seq(min(y) + 0.05, max(y), length = 90)
## Not run:
#any bandwidth can be used
require(KernSmooth)
h <- dpik(y)
den <- Weibull(x = xx, y = y, h = h)
## End(Not run)
#if bandwidth is missing
y <- rexp(100, 1)
xx <- seq(min(y) + 0.05, max(y), length = 100)
den <- Weibull(x = xx, y = y, k = 90)
Calculate Mean Square Error( MSE) by using Extreme value distributions
Description
This function calculates the mean squared error (MSE) by using user specified kernel. But distribution of vector should be Exponential, Gamma, Gumbel, Frechet or Weibull. Any other choice of distribution will result NaN
. This function is simillar to function mse
in DELTD, but here more distributions are available for distribution vector.
Usage
mse(kernel, type)
Arguments
kernel |
type of kernel which is to be used |
type |
mention distribution of vector.If exponential distribution then use |
Value
Mean Squared Error (MSE)
Author(s)
Javaria Ahmad Khan, Atif Akbar
References
Salha, R. B., El Shekh Ahmed, H. I., & Alhoubi, I. M. 2014. Hazard Rate Function Estimation Using Weibull Kernel. Open Journal of Statistics 4 (08), 650-661.
Khan, J. A., & Akbar, A. 2021. Density Estimation Using Gumbel Kernel Estimator. Open Journal of Statistics 11 (2), 319-328.
Examples
y <- rexp(100, 1)
xx <- seq(min(y) + 0.05, max(y), length = 500)
h <- 2
gr <- Gumbel(x = xx, y = y, k = 200, h = h)
mse(kernel = gr, type = "Exp")
## if distribution is other than mentioned \code{type} is used then NaN will be produced.
## Not run:
mse(kernel = gr, type ="Beta")
## End(Not run)
Density Plot by Gumbel kernel
Description
Plot kernel density by using Gumbel Kernel.
Usage
## S3 method for class 'Gumbel'
plot(x, ...)
Arguments
x |
an object of class "Gumbel" |
... |
Not presently used in this implementation |
Value
nothing
Author(s)
Javaria Ahmad Khan, Atif Akbar.
References
Khan, J. A., & Akbar, A. 2021. Density Estimation Using Gumbel Kernel Estimator. Open Journal of Statistics 11 (2), 319-328.
See Also
For Weibull kernel see plot.Weibull
. To calculate Gumbel estimated values see Gumbel
and for MSE mse
.
Examples
y <- rlnorm(100, meanlog = 0, sdlog = 1)
h <- 1.5
xx <- seq(min(y) + 0.05, max(y), length = 200)
den <- Gumbel(x = xx, y = y, k = 200, h = h)
plot(den, type = "l")
##other details can also be added
y <- rlnorm(100, meanlog = 0, sdlog = 1)
grid <- seq(min(y) + 0.05, max(y), length = 200)
h <- 0.79 * IQR(y) * length(y) ^ (-1/5)
gr <- Gumbel(x = grid, y = y, k = 200, h = h)
plot(gr, type = "s", ylab = "Density Function", lty = 1, xlab = "Time")
## To add true density along with estimated
d1 <- density(y, bw = h)
lines(d1, type = "p", col = "red")
legend("topright", c("Real Density", "Density by Gumbel Kernel"),
col=c("red", "black"), lty=c(1,2))
Density Plot by Weibull kernel
Description
Plot density by using Weibull Kernel.
Usage
## S3 method for class 'Weibull'
plot(x, ...)
Arguments
x |
an object of class "Weibull" |
... |
Not presently used in this implementation |
Value
nothing
Author(s)
Javaria Ahmad Khan, Atif Akbar.
References
Salha, R. B., El Shekh Ahmed, H. I., & Alhoubi, I. M. 2014. Hazard Rate Function Estimation Using Weibull Kernel. Open Journal of Statistics 4 (08), 650-661.
See Also
For Gumbel kernel see plot.Gumbel
. To calculate Weibull estimated values see Weibull
and for
MSE use mse
.
Examples
y <- rlnorm(100, meanlog = 0, sdlog = 1)
h <- 1.5
xx <- seq(min(y) + 0.05, max(y), length = 200)
den <- Weibull(x = xx, y = y, k = 200, h = h)
plot(den, type = "l")
##other details can also be added
y <- rlnorm(100, meanlog = 0, sdlog = 1)
grid <- seq(min(y) + 0.05, max(y), length = 200)
h <- 0.79 * IQR(y) * length(y) ^ (-1/5)
gr <- Weibull(x = grid, y = y, k = 200, h = h)
plot(gr, type = "s", ylab = "Density Function", lty = 1, xlab = "Time")
## To add true density along with estimated
d1 <- density(y, bw = h)
lines(d1, type = "p", col = "green")
legend("topright", c("Real Density", "Density by Weibull Kernel"),
col=c("green", "black"), lty=c(1,2))