Chapter 1 About
1.1 What and Why
Traditionally the excitation noise of spatial and temporal models is Gaussian. Take, for instance, an AR1 (autoregressive of order 1) process, where the increments \(x_{i+1}-\rho x_i, |\rho|<1\) are assumed to follow a Gaussian distribution. However, real-world data may not be Gaussian in nature, and it is well known that outliers can adversely affect the inferences and predictions made from a Gaussian model. We illustrate in this Bookdown how to implement a generic class of non-Gaussian models in Stan. The models have the same mean and covariance structure as Gaussian models, but have more flexible sample path behaviors and skewed marginals with heavier tails. This generic class contains many models used in applications as special cases, such as AR and random walk (RW) processes for time series, spatial Matérn models, and SAR and CAR models for areal data.
1.2 Setup
If \(\mathbf{x}\) follows a normal distribution with mean \(\mathbf{0}\) and precision matrix \(\mathbf{D}^T\text{diag}(\mathbf{h})^{-1}\mathbf{D}\), then it can be declared in Stan as:
x ~ multi_normal_prec(rep_vector(0,N), D'*diag_matrix(1/h)*D)
The non-Gaussian model declaration is:
x ~ nig_model(D, etas, zetas, h, 1)
where etas
, zetas
are parameters that regulate the kurtosis and skewness of the model, and the last argument is an integer with value 1 if the log-determinant of \(\mathbf{D}\) should be computed (if \(\mathbf{D}\) depends on parameters), or 0 otherwise.
The nig_model
and other Stan functions can be found in nigstan\files\functions.stan
on github.com/rafaelcabral96.
1.3 This Bookdown
We will be using the CmdStanR interface to fit the Stan models. This Bookdown is organized as follows:
- Section 2: Contains a theoretical introduction to the non-Gaussian models we are studying and several details for the analytically inclined that you may skip.
- Section 3: Shows how to use the different Stan functions to fit non-Gaussian models.
- Section 4: Compares the performance of the 3 implementations we propose.
- Section 5: Time-series application
- Section 6: Geostatistics application
- Section 7: Areal data application (SAR and CAR models)
1.4 Citation
If you use the code related to this project please cite Cabral, Bolin, and Rue (2022).