`meshed`

, available on CRAN, is the R package which implements:

- Bayesian spatial regression with latent Meshed Gaussian Processes (MGPs)
- for multivariate data, coregionalization/spatial factor models on latent MGPs
- for non-Gaussian outcomes, sampling via the Langevin methods of the SiMPA paper
- gridding and parameter expansion from the GriPS article.

The main function is `spmeshed`

which can do Bayesian spatial regression in any combination of the following:

- data at irregular spatial locations;
- spatiotemporal data;
- multivariate outcomes;
- spatial misalignment of multivariate outcomes;
- spatial or spatiotemporal factor models;
- outcomes of different types (currently: Gaussian, Poisson, Binomial, Beta).

## Shiny app for R package `meshed`

This simple Shiny app generates bivariate spatial data on a grid, then fits a cubic MGP using a Gibbs sampler (if both outputs are chosen Gaussian) or via SiMPA/Langevin if not. This app runs `meshed::spmeshed`

on 8 cores on an AMD Ryzen 9 5950X CPU

- MCMC restarts from scratch each time a parameter is changed;
**none**of the simulation parameters are sent to`spmeshed`

- expected MCMC runtime is about 10 seconds with
`n=3000`

and`5000`

iterations, and about 30 seconds with`n=5000`

and`10000`

MCMC iterations - error variance = nugget for Gaussian outcomes, scale = overdispersion parameter for sampling Negative Binomial outcomes. Error variance/scale are ignored if not Gaussian or Negative Binomial
- spatial decay parameters are used in a coregionalization model in which each margin has an exponential covariance