# Integrated Laplace: signature specifies cov or precision

Currently the prototype integrated Laplace approximation lets the user specify the prior covariance matrix. Mathematically there are advantages to specifying the model in terms of a precision matrix.

We are nowhere near an implementation which supports a precision matrix but looking into the future, we would want to distinguish the two by indicating in the function’s name whether the user passes the covariance or precision matrix.

// current name, uses cov matrix
laplace_marginal_lpdf();

// new names
laplace_marginal_cov_lpdf();
laplace_marginal_precision_lpdf();

The question is do we want to rename the existing function in anticipation of an implementation which supports precision matrices? As @avehtari points out, even if such an implementation only arrives in a few years, we may as well change the name now to avoid a refactor in the future.

My inclination is to say no, because I think it’s fine to have the default be covariance, and then have a precision as a special case. As @stevebronder pointed out, we use multinormal and multinormal_cholesky, and we don’t have multinormal_cov.

Posting this to hear some opinions.

1 Like

Maybe laplace_marginal_prec_lpdf following 24.2 Multivariate normal distribution, precision parameterization | Stan Functions Reference

I agree now that following multi_normal to not use cov is fine.

1 Like

do you get any additional benefit by specifying a cholesky factor?

I just took a look and this would speed it up to have a laplace_marginal_cholesky_lpdf. On the current implementation, the cholesky_decompose calls on the covariance matrix, it’s probably better to do ldlt for more stable numerics like we do in the multi_normal_lpdf file. There are specialties for mdivide_left_ldlt and log_determinant_ldlt.

laplace_marginal_lpdf is not given covariance matrix, but a functor that builds the covariance matrix. I don’t there is a benefit of laplace_marginal_cholesky_lpdf unless we would also allow pre-computed fixed choleskys

2 Likes