MBGapp
Interactive 'shiny' Application for Model-Based Geostatistics
Provides an interactive 'shiny' application for teaching and applied analysis of geostatistical data. Users can explore spatial data, assess spatial correlation through the empirical variogram, fit model-based geostatistical models for continuous, prevalence and count outcomes, produce spatial predictions, and download reports. The methodology follows the model-based geostatistics framework of Diggle and Giorgi (2019, ISBN:9781138732353).
README
<!-- README.md is generated from README.Rmd. Please edit that file -->
# MBGapp
<!-- badges: start -->
<!-- badges: end -->
**MBGapp** is an interactive Shiny application for teaching and
practising model-based geostatistics (MBG). It guides users through the
complete spatial analysis workflow — data exploration, variogram
fitting, model estimation, and spatial prediction — without requiring
any coding.
## Features
- **Three outcome types** — continuous, prevalence (binomial), and count
(Poisson)
- **Interactive maps** — leaflet-based exploration and prediction maps
with pan/zoom
- **Empirical variogram** — adjustable bins, distance cutoff, and
correlation functions
- **Bayesian estimation** — geostatistical model fitting via
RiskMap (MCMC) with an optional INLA (fast Bayes) backend when the
INLA package is installed
- **Spatial prediction** — mean surface, standard error, exceedance
probability, and quantile maps over a user-defined grid
- **Downloadable report** — generate a PDF report with selected outputs
- **Shapefile support** — upload a boundary shapefile to constrain maps
and grids
- **Covariate support** — include linear and non-linear covariate
effects
## Workflow
| Tab | What you do |
|----|----|
| **Explore** | Upload data, choose data type, inspect the spatial distribution on an interactive map and scatter plots |
| **Variogram** | Examine spatial correlation structure; fit theoretical variogram models |
| **Estimation** | Fit a geostatistical model; view parameter estimates and 95% confidence intervals |
| **Prediction** | Map the predicted surface over the study region |
| **Report** | Download a PDF report of selected outputs |
## Installation
Install the development version from GitHub:
``` r
# install.packages("devtools")
devtools::install_github("olatunjijohnson/MBGapp", ref = "main")
```
Then launch the app:
``` r
library(MBGapp)
run_app()
```
## Run without installing
``` r
shiny::runGitHub(
repo = "MBGapp",
username = "olatunjijohnson",
ref = "main",
subdir = "inst/MBGapp"
)
```
## Online version
Access the app directly in your browser — no R installation needed:
**<https://olatunjijohnson.shinyapps.io/mbgapp/>**
## Example data
The package ships with the **Loa loa** prevalence survey dataset from
Cameroon (columns: `Longitude`, `Latitude`, `Positive`, `Examined`). A
10 km prediction grid and covariate rasters for Cameroon are also
included.
Additional example files can be downloaded from Google Drive:
- [Loa loa survey
data](https://drive.google.com/uc?export=download&id=1nGRuw-UUFYbG0Wl4XD4noxaNb1iyyky9)
- [10 km prediction
grid](https://drive.google.com/uc?export=download&id=1-P880pttLqOlyQnW6_K1MPsEQo_Gh4zM)
- [Covariate
rasters](https://drive.google.com/uc?export=download&id=1fe5i08xIghPP_kHUHiL0SNT1usa8L-OD)
## Dependencies
MBGapp uses the following R packages:
`shiny`, `shinyjs`, `sf`, `terra`, `leaflet`, `leafem`, `tidyterra`,
`stars`, `ggplot2`, `dplyr`, `readr`, `tidyr`, `magrittr`, `splines`,
`geoR`, [RiskMap](https://github.com/claudiofronterre/RiskMap) (MCMC
backend), and optionally [INLA](https://www.r-inla.org) (fast Bayes
backend).
## Authors
Olatunji Johnson, Claudio Fronterre, Emanuele Giorgi CHICAS, Lancaster
Medical School, Lancaster University
Versions across snapshots
| Version | Repository | File | Size |
|---|---|---|---|
0.1.0 |
rolling linux/jammy R-4.5 | MBGapp_0.1.0.tar.gz |
329.6 KiB |
0.1.0 |
rolling linux/noble R-4.5 | MBGapp_0.1.0.tar.gz |
343.8 KiB |
0.1.0 |
rolling source/ R- | MBGapp_0.1.0.tar.gz |
329.6 KiB |
0.1.0 |
latest linux/jammy R-4.5 | MBGapp_0.1.0.tar.gz |
329.6 KiB |
0.1.0 |
latest linux/noble R-4.5 | MBGapp_0.1.0.tar.gz |
343.8 KiB |
0.1.0 |
latest source/ R- | MBGapp_0.1.0.tar.gz |
329.6 KiB |
0.1.0 |
2026-04-23 source/ R- | MBGapp_0.1.0.tar.gz |
0 B |