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).


MBGapp

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:

# install.packages("devtools")
devtools::install_github("olatunjijohnson/MBGapp", ref = "main")

Then launch the app:

library(MBGapp)
run_app()

Run without installing

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:

Dependencies

MBGapp uses the following R packages:

shiny, shinyjs, sf, terra, leaflet, leafem, tidyterra, stars, ggplot2, dplyr, readr, tidyr, magrittr, splines, geoR, RiskMap (MCMC backend), and optionally INLA (fast Bayes backend).

Authors

Olatunji Johnson, Claudio Fronterre, Emanuele Giorgi CHICAS, Lancaster Medical School, Lancaster University

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("MBGapp")

0.1.0 by Olatunji Johnson, 3 months ago


https://github.com/olatunjijohnson/MBGapp


Report a bug at https://github.com/olatunjijohnson/MBGapp/issues


Browse source code at https://github.com/cran/MBGapp


Authors: Olatunji Johnson [cre, aut] (ORCID: , Claudio Fronterre [aut] , Emanuele Giorgi [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports geoR, ggplot2, shiny, sf, dplyr, readr, tidyr, magrittr, leaflet, leafem, tidyterra, stars, RiskMap, terra, grDevices, shinyjs, splines, httr2, rmarkdown

Suggests INLA, covr, testthat


See at CRAN