RegulariseByAlpha: Function to regularise densities to have (larger) minimum...

Description Usage Arguments Details Value See Also Examples

View source: R/RegulariseByAlpha.R

Description

If possible, regularises the input density y to have minimum density value is alpha. See details.

Usage

1
RegulariseByAlpha(x, y, alpha = 0.01)

Arguments

x

support of the density

y

values of the density

alpha

scalar to regularise with (default = 0.01) - this will be the minimum value of the regularised density, unless min(y) > alpha, in which case no regularisation will be performed

Details

If min(y) >= alpha or y is the uniform distribution, no regularisation is performed and y is returned. If alpha*diff(range(x)) > 1, the regularisation is not possible and an error is thrown. Otherwise, the regularised density is computed by adding an appropriate constant gam y, followed by renormalisation to have integral 1.

Value

dens density values on x

See Also

DeregulariseByAlpha,normaliseDensities

Examples

1
2
3
4
 x = seq(0,1,length.out=122)
 y = seq(0,2,length.out=122)
 z = RegulariseByAlpha(x=x, y=y, alpha = 0.1)
 

fdadensity documentation built on Dec. 5, 2019, 9:07 a.m.