Learn R Programming

ksm (version 1.0)

integrate_spd: Integration with respect to symmetric positive definite matrices

Description

Given a function f defined over the space of symmetric positive definite matrices, compute an integral via numerical integration using the routine cubintegrate.

Usage

integrate_spd(
  f,
  dim,
  tol = 0.001,
  lb = 1e-08,
  ub = Inf,
  neval = 1000000L,
  method = c("suave", "hcubature"),
  ...
)

Value

list returned by the integration routine. See the documentation of cubintegrate for more details.

Arguments

f

function to evaluate that takes as arguments array of size dim by dim by 1.

dim

dimension of integral, only two or three dimensions are supported

tol

double for tolerance of numerical integral

lb

lower bound for integration range of eigenvalues

ub

upper bound for integration range of eigenvalues

neval

maximum number of evaluations

method

string indicating the method from cubature

...

additional arguments for the function f

Examples

Run this code
integrate_spd(
  dim = 2L,
  neval = 1e4L,
  f = function(x, S){
   dWishart(x, df = 10, S = S, log = FALSE)},
  S = diag(2))

Run the code above in your browser using DataLab