getWFmean {fdadensity} | R Documentation |
Wasserstein Frechet Mean Computation
Description
Function for computing the Wasserstein Frechet mean through quantile density averaging
Usage
getWFmean(
dmatrix,
dSup,
N = length(dSup),
qdSup = seq(0, 1, length.out = N),
useAlpha = FALSE,
alpha = 0.01
)
Arguments
dmatrix |
matrix of density values on dSup - must be strictly positive and each row must integrate to 1 |
dSup |
support (grid) for Density domain |
N |
desired number of points on a [0,1] grid for quantile density functions; default length(dSup) |
qdSup |
support for LQ domain - must begin at 0 and end at 1; default [0,1] with N-equidistant support points |
useAlpha |
should regularisation be performed (default=FALSE) |
alpha |
Scalar to regularise the supports with (default=0.01) |
Value
wfmean the Wasserstein-Frechet mean density
References
Functional Data Analysis for Density Functions by Transformation to a Hilbert space, Alexander Petersen and Hans-Georg Mueller, 2016
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))
wfmean = getWFmean(y, x)
# Plot WF mean with Euclidean Mean
matplot(x, t(y), ylab = 'Density', type = 'l', lty = 1, col = 'black')
lines(x, wfmean, lwd = 2, col = 'red')
lines(x, colMeans(y), lwd = 2, col = 'blue')
legend('topright', col = c('black', 'red', 'blue'), lwd = c(1, 2, 2),
legend = c('Densities', 'WF Mean', 'Euclidean Mean'))
[Package fdadensity version 0.1.2 Index]