# Density plot with epanechnikov with exceedance data

I'm trying to replicate empirical density plot from the paper "Computing Maximum Likelihood Estimates for the Generalized Pareto Distribution".

The data is Exceedance (in kg/mm2) of the Testing Threshold in Tensile-Strength Tests for a Random Sample of n = 15 Nylon Carpet Fibers. Below is the density estimate using Epanechnikov kernel. The paper is about generalized pareto distribution using exceedance data, related to extreme value theory.

I tried to replicate/reproducing this figure in R using density, but unable to do this, see below for reproducible example based on the data in the paper.

tensile_strength <- (0.051,0.140,0.365,0.561,0.030,0.268,0.184,0.1,0.876,0.092,0.011,0.2,0.518,0.338,0.056)

plot(density(tensile_strength, bw=0.18, kernel=c("epanechnikov"),from=0.01, to=1))
lines(x=tensile_strength,y=rep(0,length(ans)),type="p")


Here is the density plot.

The plot is nowhere close to what is in the article.

My question is how does one account for "Epanechnikov kernel with boundary kernel modifications (since the exceedances must be greater than 0)"

• Uff... messy. (+1). It relates to the fact that as we go closer to the boundaries the weights of the kernel window falling outside the support are set to 0 and the remaining non-zero weights (i.e. the one still in the support) are upscaled such that they sum up to 1. Quite common for all kernel regression approaches actually; e.g. see the Wikipedia article on Kernel regression and notice the normalisation in the Nadaraya-Watson estimator's denominator. Apr 6, 2021 at 4:59
• @usεr11852 thanks, your comment helped me solve the question. Apr 16, 2021 at 1:06

I was able to follow @usεr11852 comments and was able to reproduce from the original paper. For truncated/bounded data one would have to used bounded density estimation.

Below is the code to reproduce the plots from the paper.

library(bde)

## Data
tensile_strength <- c(0.051,0.140,0.365,0.561,0.030,0.268,0.184,0.1,0.876,0.092,0.011,0.2,0.518,0.338,0.056)

## Density plots with bounded data
plot(bde(tensile_strength,estimator="boundarykernel",lower.limit = 0,upper.limit = 1,options = list(mu=1)))


• Sweet! Thank you for sharing. (+1) Apr 16, 2021 at 1:12
• You are correct let me fix it. Apr 16, 2021 at 1:23
• Thansk for pointing it out @usεr11852 I have fixed the answer. Apr 16, 2021 at 1:28