stats.inla {INLAspacetime}R Documentation

To retrieve goodness of fit statistics for a specific model class.

Description

Extracts dic, waic and log-cpo from an output returned by the inla function from the INLA package or by the bru function from the inlabru package, and computes log-po, mse, mae, crps and scrps for a given input. A summary is applied considering the user imputed function, which by default is the mean.

Usage

stats.inla(m, i = NULL, y, fsummarize = mean)

Arguments

m

an inla output object.

i

an index to subset the estimated values.

y

observed to compare against.

fsummarize

the summary function, the default is base::mean().

Value

A named numeric vector with the extracted statistics.

Details

It assumes Gaussian posterior predictive distributions! Considering the defaults, for n observations, yi,i=1,2,...,ny_i, i = 1, 2, ..., n, we have

. dic

idi/n\sum_i d_i/n

where did_i is the dic computed for observation i.

. waic

iwi/n\sum_i w_i/n

where wiw_i is the waic computed for observation i.

. lcpo

ilog(pi)/n-\sum_i \log(p_i)/n

where pip_i is the cpo computed for observation i.

For the log-po, crps, and scrps scores it assumes a Gaussian predictive distribution for each observation yiy_i which the following definitions: zi=(yiμi)/σiz_i = (y_i-\mu_i)/\sigma_i, μi\mu_i is the posterior mean for the linear predictor, σi=vi+1/τy\sigma_i = \sqrt{v_i + 1/\tau_y}, τy\tau_y is the observation posterior mean, viv_i is the posterior variance of the linear predictor for yiy_i.

Then we consider ϕ()\phi() the density of a standard Gaussian variable and ψ()\psi() the corresponding Cumulative Probability Distribution.

. lpo

ilog(ϕ(zi))/n-\sum_i \log(\phi(z_i))/n

. crps

iri/n\sum_i r_i/n

where

ri=σi/π2σiϕ(zi)+(yiμi)(12ψ(zi))r_i=\sigma_i/\sqrt{\pi} - 2\sigma_i\phi(z_i) + (y_i-\mu_i)(1-2\psi(z_i))

. scrps

isi/n\sum_i s_i/n

where

si=log(2σi/π)/2π(ϕ(zi)σizi/2+ziψ(zi))s_i=-\log(2\sigma_i/\sqrt{\pi})/2 -\sqrt{\pi}(\phi(z_i)-\sigma_iz_i/2+z_i\psi(z_i))

Warning

All the scores are negatively oriented which means that smaller scores are better.

References

Held, L. and Schrödle, B. and Rue, H. (2009). Posterior and Cross-validatory Predictive Checks: A Comparison of MCMC and INLA. Statistical Modelling and Regression Structures pp 91–110. https://link.springer.com/chapter/10.1007/978-3-7908-2413-1_6.

Bolin, D. and Wallin, J. (2022) Local scale invariance and robustness of proper scoring rules. Statistical Science. doi:10.1214/22-STS864.


[Package INLAspacetime version 0.1.8 Index]