BayesSpaceBasis: Create a basis for a Bayes space

View source: R/classes.R

BayesSpaceBasisR Documentation

Create a basis for a Bayes space

Description

Creates the finite-dimensional basis in which distributional data are represented for computation. Besides the functional spline basis and its [BayesSpace], the returned object stores the transformation matrix 'A' and the Gram matrix 'S' (the inner products of the basis elements).

Usage

BayesSpaceBasis(basis, ...)

## S3 method for class 'basisfd'
BayesSpaceBasis(
  basis,
  bayesSpace = BayesSpace(ReferenceMeasureUniform(basis$rangeval[1], basis$rangeval[2])),
  A = computeL22BayesSpacesBasisMatrix(basis),
  S = A %*% fda::inprod(basis, basis) %*% t(A)/diff(basis$rangeval),
  orthonormalize = FALSE,
  ...
)

## S3 method for class 'fd'
BayesSpaceBasis(basis, ...)

## S3 method for class 'BayesSpace'
BayesSpaceBasis(basis, ...)

Arguments

basis

the object describing the basis (a function, an 'fda' basis, a reference measure, or a [BayesSpace]).

...

further generic arguments

bayesSpace

the BayesSpace this basis is designed for

A

the transformation matrix mapping the result of the function to the basis values

S

the Gram (metric) matrix of the given basis, 'S[i,j] = <psi_i, psi_j>'. For an orthonormal basis 'S' is the identity; for ZB-splines it is not. Used by all inner-product based operations.

orthonormalize

boolean if true creates an orthonormal basis, by a sigualr value decomposition based orthonormalization.

Details

The default basis (constructed from a reference measure or an 'fda' B-spline basis) consists of **zero-integral B-splines (ZB-splines)**: spline functions that integrate to zero, which is required to represent centred-log-ratio (clr) transformed densities. The object stores

'basis'

a function evaluating the underlying (B-spline) basis,

'A'

the transformation matrix mapping those values to the ZB-spline basis, so the basis functions are 'zeta = A %*% B',

'S'

the Gram (metric) matrix 'S[i,j] = <zeta_i, zeta_j>',

'bayesSpace', 'centered'

the space and a centring flag.

ZB-splines are **not orthonormal**, so in general 'S' is not the identity; inner products, norms, variances and PCA all use 'S' (see [getMetricTensor], [princomp.BData]). Pass an explicit 'S' only if you have a better value than the internally computed one.

Value

An object of class '"BayesSpaceBasis"': a list with components 'basis', 'bayesSpace', 'A', 'S' and 'centered'.

Methods (by class)

  • BayesSpaceBasis(basisfd): Construct from an basisfd object from functional data

  • BayesSpaceBasis(fd): Construct from an fd object from functional data

  • BayesSpaceBasis(BayesSpace): Calls BayesSpaceBasis on the Reference measure

See Also

[getMetricTensor], [BayesSpace], [as.BDataSplines], [princomp.BData]

[fda::basisfd]

[fda::fd]

Examples

basis <- BayesSpaceBasis(B2Unif01, nbasis = 7)
getMetricTensor(basis)        # Gram matrix S (not the identity for ZB-splines)

DistributionalDDA documentation built on Oct. 20, 2026, 5:06 p.m.