FPCAdens {fdadensity}R Documentation

FPCA for densities by log quantile density transformation

Description

Perform FPCA on LQD-transformed densities

Usage

FPCAdens(
  dmatrix,
  dSup,
  lqdSup = seq(0, 1, length.out = length(dSup)),
  useAlpha = FALSE,
  alpha = 0.01,
  optns = list(dataType = "Dense", error = FALSE)
)

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)

optns

A list of options for FPCA. See documentation for FPCA.

Details

Densities are transformed to log-quantile densities, followed by standard FPCA. If useAlpha = TRUE, densities are regularized before transformation

References

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

See Also

RegulariseByAlpha,lqd2dens,MakeLQDsample,FPCA

Examples


## Densities for Top 50 Female Baby Names
data(Top50BabyNames)

# Perform Transformation FPCA for male baby name densities
X = FPCAdens(dmatrix = t(Top50BabyNames$dens$female), dSup = Top50BabyNames$x, useAlpha = TRUE, 
                  optns = list(dataType = 'Dense', error = FALSE, methodSelectK = 2))
x = Top50BabyNames$x

# Plot Modes

Qvec = quantile(X$xiEst[,1], probs = c(0.1, 0.25, 0.75, 0.9))/sqrt(X$lambda[1])
CreateModeOfVarPlotLQ2D(X, k = 1, dSup = x, Qvec = Qvec, main = 'First Mode, Density space')
CreateModeOfVarPlotLQ2D(X, domain = 'Q', k = 1, dSup = x, Qvec = Qvec, 
                            main = 'First Mode, LQD space')

Qvec = quantile(X$xiEst[,2], probs = c(0.1, 0.25, 0.75, 0.9))/sqrt(X$lambda[2])
CreateModeOfVarPlotLQ2D(X, k = 2, dSup = x, Qvec = Qvec, main = 'Second Mode, Density Space')
CreateModeOfVarPlotLQ2D(X, domain = 'Q', k = 2, dSup = x, Qvec = Qvec, 
                            main = 'Second Mode, LQD space')


[Package fdadensity version 0.1.2 Index]