Skip to contents

Fits a density of the form \(p(x) = \exp(\phi(x)^\top c)/C\) on a bounded interval, with optional smoothness penalty. Dispatches between the Rust backend (default, ~10–60x faster) and the original R algorithm (preserved as density_mpl_legacy()).

Usage

density_mpl(
  x,
  WfdParobj,
  conv = 1e-04,
  iterlim = 20,
  backend = c("rust", "legacy"),
  ...
)

Arguments

x

Observation vector or two-column (value, frequency) matrix.

WfdParobj

An fdPar object (or fd / basisfd).

conv

Convergence tolerance on the objective. Default 1e-4.

iterlim

Maximum Fisher-scoring iterations. Default 20.

backend

Which implementation to use. "rust" (default) calls the compiled kernel via density_mpl_rust(); "legacy" calls the original R code density_mpl_legacy() for bit-for-bit compatibility.

...

Further arguments forwarded to the selected backend.

Value

A list with Wfdobj, C, Flist, iternum, iterhist.