Build a distributional-data (dd) object
dd.RdConstructor for a dd object: a B-spline fd representation of a
log-density together with its normalizing constant (so the density is
exp(W(x)) / constant).
Usage
dd(
sample = NULL,
full_sample = sample,
basis = fda::create.bspline.basis(rangeval = rangeval, nbasis = nbasis, norder =
norder, breaks = breaks),
knots_pos = "quantiles",
breaks = if (is.numeric(sample)) {
if (knots_pos == "quantiles") {
quantile(full_sample, seq(0, 1, length.out = nbasis - norder + 2))
}
else
{
quantile(range(full_sample), seq(0, 1, length.out = nbasis - norder + 2))
}
} else {
NULL
},
rangeval = if (is.numeric(sample)) range(breaks) else c(0, 1),
nbasis = 12,
norder = 5,
lambda = 0,
clr = fda::fd(basisobj = basis),
constant = NULL,
normalize = TRUE,
...
)Arguments
- sample
Optional numeric sample used to estimate the density.
- full_sample
Pooled reference sample for knot placement. Defaults to
sample.- basis
A
basisfdobject. Defaults to a B-spline basis built fromrangeval,nbasis,norder,breaks.- knots_pos
How to derive knots from
full_sample("quantiles"by default).- breaks
Numeric vector of knot positions. By default chosen from
full_sampleaccording toknots_pos;NULLfor non-numeric input.- rangeval
Numeric pair giving the range over which the density lives. Defaults to
range(breaks)for numeric input,c(0, 1)otherwise.- nbasis
Number of basis functions. Default
12.- norder
B-spline order. Default
5.- lambda
Penalty parameter forwarded to
density_mpl().- clr
Pre-computed clr-transformed
fd(skip density estimation if supplied).- constant
Optional pre-computed normalizing constant.
- normalize
Logical; if
TRUE(default) compute the normalizing constant vianormalize().- ...
Further arguments forwarded to
density_mpl().