degross {degross} | R Documentation |
Density estimation from tabulated data with given frequencies and group central moments.
Description
Estimation of a density from tabulated summary statistics evaluated within each of the big bins (or classes) partitioning the variable support. These statistics include class frequencies and central moments of orders one up to four. The log-density is modelled using a linear combination of penalized B-splines. The multinomial log-likelihood involving the frequencies adds up to a roughness penalty based on differences of neighboring B-spline coefficients and to the log of a root-n approximation of the sampling density of the observed vector of central moments within each class. The so-obtained penalized log-likelihood is maximized using the EM algorithm to get an estimation of the spline parameters and, hence, of the variable density and related quantities such as quantiles, see Lambert (2021) for details.
Usage
degross(degross.data,
phi0 = NULL, tau0 = 1000,
use.moments = rep(TRUE,4), freq.min = 20, diag.only=FALSE,
penalize = TRUE,
aa = 2, bb = 1e-06, pen.order = 3, fixed.tau = FALSE,
plotting = FALSE, verbose = FALSE, iterlim=20)
Arguments
degross.data |
A degrossData.object generated by degrossData. |
phi0 |
Starting value for the |
tau0 |
Starting value for the roughness penalty parameter. Default: 1000. |
use.moments |
Vector with 4 logicals indicating which tabulated sample moments to use as soft constraints. Defaults: |
freq.min |
Minimal big bin frequency required to use the corresponding observed moments as soft constraints. Default: |
diag.only |
Logical indicating whether to ignore the off-diagonal elements of the variance-covariance matrix of the sample central moments. Default: FALSE. |
penalize |
Logical indicating whether a roughness penalty of order |
aa |
Positive real giving the first parameter in the Gamma prior for |
bb |
Positive real giving the second parameter in the Gamma prior for |
pen.order |
Integer giving the order of the roughness penalty. Default: |
fixed.tau |
Logical indicating whether the roughness penalty parameter |
plotting |
Logical indicating whether an histogram of the data with the estimated density should be plotted. Default: FALSE. |
verbose |
Logical indicating whether details on the estimation progress should be displayed. Default: FALSE. |
iterlim |
Maximum number of iterations during the M-step. Default: 20. |
Value
An object of class degross
containing several components from the density estimation procedure. Details can be found in degross.object
. A summary of its content can be printed using print.degross
or plotted using plot.degross
.
Author(s)
Philippe Lambert p.lambert@uliege.be
References
Lambert, P. (2021) Moment-based density and risk estimation from grouped summary statistics. arXiv:2107.03883.
See Also
degross.object
, ddegross
, pdegross
, qdegross
.
Examples
## Simulate grouped data
sim = simDegrossData(n=3500, plotting=TRUE,choice=2,J=3)
print(sim$true.density) ## Display density of the data generating mechanism
## Create a degrossData object
obj.data = with(sim, degrossData(Big.bins=Big.bins, freq.j=freq.j, m.j=m.j))
print(obj.data)
## Estimate the density underlying the grouped data
obj.fit = degross(obj.data)
## Plot the estimated density...
plot(obj.fit)
## ... and compare it with the ('target') density used to simulate the data
curve(sim$true.density(x),add=TRUE,col="red",lwd=2)
legend("topleft",
legend=c("Observed freq.","Target density","Estimated density"),
col=c("grey85","red","black"), lwd=c(10,2,2),
lty=c("solid","solid","dashed"), box.lty=0, inset=.02)