Learn R Programming

degross (version 0.9.0)

degross_lpost: Log-posterior (with gradient and Fisher information) for given spline parameters, small bin frequencies, tabulated sample moments and roughness penalty parameter. This function is maximized during the M-step of the EM algorithm to estimate the B-spline parameters entering the density specification.

Description

Log-posterior (with gradient and Fisher information) for given spline parameters, small bin frequencies, tabulated sample moments and roughness penalty parameter. This function is maximized during the M-step of the EM algorithm to estimate the B-spline parameters entering the density specification.

Usage

degross_lpost(phi, tau, n.i, degross.data,
                     use.moments = rep(TRUE,4), freq.min = 20, diag.only=FALSE,
                     penalize = TRUE, aa = 2, bb = 1e-6, pen.order = 3)

Arguments

phi

Vector of K B-spline parameters \(\phi\) to specify the log-density.

tau

Roughness penalty parameter.

n.i

Small bin frequencies.

degross.data

A degrossData.object created using the degrossData function.

use.moments

Vector with 4 logicals indicating which tabulated sample moments to use as soft constraints. Defaults: rep(TRUE,4).

freq.min

Minimal big bin frequency required to use the corresponding observed moments as soft constraints. Default: 20.

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 pen.order is required (with \(\tau \sim G(aa,bb)\)). Default: TRUE.

aa

Positive real giving the first parameter in the Gamma prior for tau. Default: 2.

bb

Positive real giving the second parameter in the Gamma prior for tau. Default: 1e-6.

pen.order

Integer giving the order of the roughness penalty. Default: 3.

Value

A list containing :

  • lpost, lpost.ni : value of the log-posterior based on the given small bin frequencies n.i and the tabulated sample moments.

  • lpost.mj : value of the log-posterior based on the big bin frequencies degross.data$freq.j and the tabulated sample moments.

  • llik.ni : multinomial log-likelihood based on the given small bin frequencies n.i.

  • llik.mj : multinomial log-likelihood based on the big bin frequencies degross.data$freq.j.

  • moments.penalty : log of the joint (asymptotic) density for the observed sample moments.

  • penalty : \(\log p(\phi|\tau) + \log p(\tau)\).

  • Score, Score.ni : score (w.r.t. \(\phi\)) of lpost.ni.

  • Score.mj : score (w.r.t. \(\phi\)) of lpost.mj.

  • Fisher & Fisher.ni: information matrix (w.r.t. \(\phi\)) of lpost.ni.

  • Fisher.mj : information matrix (w.r.t. \(\phi\)) of lpost.mj.

  • M.j : theoretical moments of the density (resulting from \(\phi\)) within a big bin.

  • pi.i : small bin probabilities.

  • ui : small bin midpoints.

  • delta : width of the small bins.

  • gamma.j : Big bin probabilities.

  • tau : reminder of the value of the roughness penalty parameter \(\tau\).

  • phi : reminder of the vector of spline parameters (defining the density).

  • n.i : reminder of the small bin frequencies given as input.

References

Lambert, P. (2021) Moment-based density and risk estimation from grouped summary statistics. arXiv:2107.03883.

See Also

degross_lpostBasic, degross, degross.object.

Examples

Run this code
# NOT RUN {
sim = simDegrossData(n=3500, plotting=TRUE,choice=2) ## Generate grouped data
obj.data = degrossData(Big.bins=sim$Big.bins, freq.j=sim$freq.j, m.j=sim$m.j)
print(obj.data)
obj.fit = degross(obj.data) ## Estimate the underlying density
## Evaluate the log-posterior at convergence
res = with(obj.fit, degross_lpost(phi, tau, n.i, obj.data, diag.only=diag.only))
print(res$Score) ## Score of the log posterior at convergence

# }

Run the code above in your browser using DataLab