Computes a density estimator by smoothing a histogram using Poisson regression. Implementation of "Lindsey's method", as descrbied in Chapter 10 of "Computer age statistical inference: algorithms, evidence, and data science' by Bradley Efron and Trevor Hastie (2016).

lindsey_density_estimate(x, K, deg)

Arguments

x
  • one-dimensional vector of data;

K
  • number of bins in the histogram;

deg
  • degree of natural splines used in Poisson regression;

Value

a list with 2 fields, centers and density, which are K-dimensional vectors containing the bin centers and estimated density within each bin respectively.