Skip to contents

A deterministic rule for continuous families, applicable only when the alternative is Gaussian (as decided by mixture_gaussian_moments()). Nodes are an affine image of a tensor-product Gauss-Hermite grid, exact for polynomials of degree up to 2 * n_nodes - 1.

Usage

gh_engine(n_nodes, max_nodes = 1e+06)

Arguments

n_nodes

Univariate nodes per dimension.

max_nodes

Refuse grids larger than this.

Value

An engine spec, to pass as the engine argument of ripr_init().

Details

The grid has n_nodes^d points, so it suits only a few dimensions. Its error is bias, not variance: raise n_nodes and compare.

References

Golub GH, Welsch JH (1969). “Calculation of Gauss quadrature rules.” Mathematics of computation, 23(106), 221–230.

Examples

fam <- gaussian_family(d = 2L)
null <- null_model(fam, halfspace_region(normal = c(1, -1)))
ripr_init(fam(c(1, 0)), null, engine = gh_engine(n_nodes = 10L))
#> <ripr_state>
#>   null     gaussian_family in 1 part
#>   iterate  1 atom, KL 0.25
#>   gap      none recorded
#>   steps    fw 0, lb 0, em 0, weight 0, sfw 0, ct 0 (0.013s)
#>   trace    1 row, 0 snapshots