clr: compute the clr transform

View source: R/helpers.R

clrR Documentation

compute the clr transform

Description

This is a generic version of clr overwriting the one in compositions

Usage

clr(x, ...)

## Default S3 method:
clr(x, ...)

## S3 method for class 'BData'
clr(x, ...)

Arguments

x

the object to be clr transformed

...

further arguments for generic use

Details

The centred log-ratio map sends a distribution to its log-density centred to integrate to zero, i.e. to its coordinates in the L2 space underlying the Bayes space. It is an isometry from the Bayes space onto the centred subspace of that L2 space, so Bayes-space distances and inner products become the ordinary L2 ones.

Value

the centred log-ratio (clr) representation of 'x'. For 'BData' objects this is the centred log-density representation (an object of class 'BDataLogDensities' whose log-density integrates to zero); the default method returns the clr transform computed by [compositions::clr].

Methods (by class)

  • clr(default): the default is [compositions::clr]

  • clr(BData): returns a centered representation as BDataLogDensities

Examples

X1 = BDataPDFs(basis=B2Unif01Basis5,
   list(
    \(x)(dbeta(x,1,2)),
    \(x)(dbeta(x,1,1)),
    \(x)(dbeta(x,1.5,0.7))
   ) )
plot(X1,main="Beta Densities on Unif(0,1)")
plot(clr(X1),main="CLRs of Beta Densities on Unif(0,1)")


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