Skip to contents

Calculates the density of emissions observations

Usage

obs_density(data, xvals = NULL, up = Inf, low = 0, kernel = "gamma", bw = NULL)

Arguments

data

Emissions data from either the best source or top performers, must have a column named emissions.

xvals

Ordered sequence of emissions to define emission densities along. Default is NULL, in which case xvals is a 1024 length sequence. between 0 and 3*max(data$emissions).

up

Optional upper limit to bound density, default is Inf.

low

Optional lower limit to bound density, default is 0.

kernel

Kernel choice for density function, default is gamma defined on (0,Inf). Other options include: c('gaussian1','gaussian2','beta1','beta2','fb','fbl','fbu','rigaussian'). See np::npuniden.boundary() for more information on kernel options.

bw

Optional bandwidth, default is NULL in which case bw = sd(emissions)*n^(-2/5), where n is number of emissions. The bandwidth can also be provided manually, or searched for using least squares cross-validation by bw = "cv.ls" or likelihood cross-validation with bw = "cv.ml".

Value

A list containing two tibbles, Obs_onPoint with exact emission observations and densities, and obs_den_df with densities for every position given in xvals.

References

Bandwidth is set following Renault O. & O. Scaillet. On the way to recovery: A parametric bias free estimation of recovery rate densities. 2004. Journal of Banking and Finance. 28:12 p. 2915-2931.