MakeLQDsample: Convenience function for converting densities to log-quantile...

Description Usage Arguments Value References See Also Examples

View source: R/MakeLQDsample.R

Description

See 'dens2lqd' and 'RegulariseByAlpha' for more details. This function first (transforms the densities in 'dmatrix' to log quantile density functions, optionally followed by regularisation.

Usage

1
2
3
4
5
6
7
MakeLQDsample(
  dmatrix,
  dSup,
  lqdSup = seq(0, 1, length.out = length(dSup)),
  useAlpha = FALSE,
  alpha = 0.01
)

Arguments

dmatrix

Matrix holding the density values on dSup - all rows must be strictly positive and integrate to 1

dSup

Support (grid) for Density domain

lqdSup

Support grid for lqd domain (default = seq(0, 1, length.out = length(dSup)))

useAlpha

should regularisation be performed (default=FALSE)

alpha

Scalar to regularise the supports with (default=0.01)

Value

list with 'LQD', a matrix of log quantile density functions, and 'lqdSup' 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

RegulariseByAlpha,dens2lqd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 

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

# Get densities

y.dens = MakeDENsample(qmatrix = y, lqdSup = x, dSup = x)$DEN
matplot(x, t(y.dens), ylab = 'Density', type = 'l', lty = 1, col = 'black')

# Get LQDs Back

y.lqd = MakeLQDsample(y.dens, lqdSup = x, dSup = x)
# These should match
matplot(y.lqd$lqdSup, t(y.lqd$LQD), ylab = 'LQD', type = 'l', lty = 1, col = 'blue')
matplot(x, t(y), ylab = 'LQD', type = 'l', lty = 1, col = 'red')

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