MakeDENsample {fdadensity}R Documentation

Convenience function for converting log quantile densities to densities

Description

See 'lqd2dens' and 'DeregulariseByAlpha' for more details. This function transforms the log quantile densities in 'qmatrix' to density functions, optionally followed by deregularisation.

Usage

MakeDENsample(
  qmatrix,
  lqdSup = seq(0, 1, length.out = ncol(qmatrix)),
  dSup = seq(0, 1, length.out = ncol(qmatrix)),
  useAlpha = FALSE,
  alpha = 0
)

Arguments

qmatrix

Matrix holding the log quantile density values on [0,1]

lqdSup

Support grid for input log quantile densities (default = seq(0, 1, length.out = ncol(qmatrix)))

dSup

Support grid for output densities (default = seq(0, 1, length.out = ncol(qmatrix)))

useAlpha

Logical indicator to deregularise the densities (default = FALSE)

alpha

Scalar to deregularise the density - where possible, this will be the minimum value for the deregularised densities (default=0)

Value

list with the 'DEN' transformed data, and 'dSup' that matches the input argument.

References

Functional Data Analysis for Density Functions by Transformation to a Hilbert space, Alexander Petersen and Hans-Georg Mueller, 2016

See Also

DeregulariseByAlpha,lqd2dens

Examples

 

x <- seq(0,1,length.out = 101)
# linear densities on (0, 1)
y <- t(sapply(seq(0.5, 1.5, length.out = 10), function(b) b + 2*(1 - b)*x)) 

# Get LQDs

y.lqd = MakeLQDsample(dmatrix = y, dSup = x)
matplot(y.lqd$lqdSup, t(y.lqd$LQD), ylab = 'LQD', type = 'l', lty = 1, col = 'black')

# Get Densities Back

y.dens = MakeDENsample(y.lqd$LQD, lqdSup = x, dSup = x) # should equate to y above
# These should look the same
matplot(y.dens$dSup, t(y.dens$DEN), ylab = 'Density', type = 'l', lty = 1, col = 'blue')
matplot(x, t(y), ylab = 'Original Density', type = 'l', lty = 1, col = 'red')


[Package fdadensity version 0.1.2 Index]