STapprox {ordgam}R Documentation

Skew-t approximation to a density evaluated on a sparse grid

Description

Skew-t approximation to a density evaluated on a sparse grid

Usage

STapprox(x, lfx)

Arguments

x

Vector containing a grid of values on the density support and covering the posterior mode.

lfx

Log density values on the grid x (possibly up to an additive constant)

Value

A list containing

Author(s)

Philippe Lambert p.lambert@uliege.be

References

Lambert, P. and Gressani, 0. (2023) Penalty parameter selection and asymmetry corrections to Laplace approximations in Bayesian P-splines models. Statistical Modelling. <doi:10.1177/1471082X231181173>. Preprint: <arXiv:2210.01668>.

See Also

SNapprox.

Examples

library(ordgam)

## Density to be approximated by a Skew-t
dtarget = function(x) dgamma(x,10,2)
curve(dtarget(x),0,15,lwd=2,ylab="Density")

## Values of the target density on a sparse grid
ngrid = 6 ## Sparse grid size
xgrid = seq(2,8,length=ngrid) ## Grid
lfx = log(dtarget(xgrid)) ## Log values

## Skew-t approximation
dp = ordgam::STapprox(xgrid,lfx)$dp
curve(sn::dst(x,dp=dp),add=TRUE,lwd=2,lty=2,col=2)
points(xgrid,exp(lfx))
legend("topright",legend=c("Target density","Skew-t approx."),
       col=1:2,lty=1:2,lwd=2,bty="n")


[Package ordgam version 0.9.1 Index]