Skip to contents

Data and projections

Choose a projected coordinate reference system, summarise the distances between locations, and build prediction grids and covariates.

propose_crs()
Propose a projected CRS for the data
crs_distortion()
Distortion of distances by a projected CRS
summarise_distance() print(<RiskMap_distance_summary>)
Summaries of the distances
create_grid()
Create Grid of Points Within Boundaries
create_convex_hull()
Convex Hull of an sf Object
get_worldpop()
Download gridded population counts from WorldPop

Exploratory analysis

Look at the data and their spatial correlation before fitting a model.

elogit()
Empirical Logit Transformation for Binomial Data
variogram()
Empirical variogram with a global permutation envelope
print(<RiskMap_variogram>)
Print Method for RiskMap_variogram Objects
plot_variogram() plot(<RiskMap_variogram>)
Plot an empirical variogram

Specifying and fitting

Write the model as a formula with a Gaussian process and random effects, choose the family and link, and fit it by maximum likelihood.

glgpm()
Estimation of Generalized Linear Gaussian Process Models
glgpm_parameters() print(<riskmap_parameters>)
List the parameters of a model before fitting it
riskmap_parameters
The parameters of a geostatistical model

Model terms

The spatial Gaussian process and unstructured random effects, as terms of the model formula.

gp()
Gaussian Process Model Specification
re()
Random Effect Model Specification

Gaussian, binomial and Poisson responses use the families of the stats package, such as binomial("probit"), and other links can be given to glgpm() as an inverse link function. Custom links and the negative binomial family are experimental and may change in a minor release.

negative_binomial() print(<RiskMap_family>)
The Negative Binomial Family

Controls

Settings of Monte Carlo maximum likelihood and of the MCMC sampler of the random effects.

set_control_mcml()
Set control parameters for certified MCML estimation
set_control_mcmc()
Set Control Parameters for Simulation

Fitted models

Print, summarise and tabulate a fit, and extract its estimates, their covariance, its log-likelihood and its fitted values.

print(<RiskMap>)
Print a Fitted RiskMap Model
summary(<RiskMap>)
Summarize Model Fits
print(<summary.RiskMap>)
Print Summary of RiskMap Model
coef(<RiskMap>)
Extract Parameter Estimates from a "RiskMap" Model Fit
fitted(<RiskMap>)
Extract fitted values from a RiskMap model
logLik(<RiskMap>) vcov(<RiskMap>) nobs(<RiskMap>)
Log-Likelihood, Covariance and Number of Observations of a Fit
to_table()
Format RiskMap Results as a Table

Checking a fit

See how a fit was computed, check the Monte Carlo samples, and measure the uncertainty of the estimates by profile likelihood or the parametric bootstrap.

check_computation()
Check How a Fitted Model Was Computed
print(<RiskMap_check>)
Print the Checks on a Fitted Model
summary(<RiskMap_check>)
Summarise the Checks on a Fitted Model
print(<summary.RiskMap_check>)
Print the Summary of the Checks on a Fitted Model
plot_computation() plot(<RiskMap_check>)
Plot the Checks on a Fitted Model
plot_mcmc()
Check the mixing of the MCMC samples of the random effects
summarise_mcmc()
Effective sample sizes of the MCMC samples of the random effects
profile(<RiskMap>) print(<RiskMap_profile>)
Profile likelihood of a fitted geostatistical model
plot_profile() plot(<RiskMap_profile>)
Plot profile likelihoods of a fitted geostatistical model
parametric_bootstrap()
Parametric bootstrap of a fitted geostatistical model
print(<RiskMap_bootstrap>) print(<summary.RiskMap_bootstrap>)
Print a parametric bootstrap
summary(<RiskMap_bootstrap>)
Summarise a parametric bootstrap
plot_bootstrap() plot(<RiskMap_bootstrap>)
Plot a parametric bootstrap

Prediction

Predict the spatial process, the linear predictor and targets on the scale of the response, at new locations or aggregated over areas.

predict(<RiskMap>)
Spatial prediction from a fitted RiskMap model
print(<RiskMap_prediction>)
Print a RiskMap prediction
plot_prediction() plot(<RiskMap_prediction>)
Map a RiskMap prediction
to_table(<RiskMap_prediction>)
Table of polygon predictions
assess_extrapolation() print(<RiskMap_extrapolation>)
Assess where predictions extrapolate beyond the data
plot_extrapolation() plot(<RiskMap_extrapolation>)
Map indicators of extrapolation

Assessment

See whether a model could have produced the data, and assess its predictions by spatial cross-validation and on simulated data.

assessment
Which function answers which question about a model
assess_fit()
Assess models against data simulated from them
print(<RiskMap_predictive_check>) print(<summary.RiskMap_predictive_check>)
Print the assessment of models against simulated data
summary(<RiskMap_predictive_check>)
Summarise the assessment of models against simulated data
plot_predictive_check() plot(<RiskMap_predictive_check>)
Plot the assessment of models against simulated data
create_test_sets()
Create test sets for cross-validation
print(<RiskMap_test_sets>)
Print test sets
plot_test_sets() plot(<RiskMap_test_sets>)
Plot test sets
assess_prediction()
Assess predictions by cross-validation
print(<RiskMap_cross_validation>)
Print a cross-validation
summary(<RiskMap_cross_validation>)
Summarise a cross-validation
print(<summary.RiskMap_cross_validation>)
Print the summary of a cross-validation
plot_cross_validation() plot(<RiskMap_cross_validation>)
Plot a cross-validation
assess_simulation()
Assess Simulations
print(<RiskMap_assess_simulation>)
Print an Assessment of Simulations
summary(<RiskMap_assess_simulation>)
Summarize Simulation Results
print(<summary.RiskMap_assess_simulation>)
Print Simulation Results

Simulation

Specify a model with known parameters and simulate data and spatial surfaces from it.

specify_glgpm()
Specify a model for simulation
simulate_glgpm()
Simulate replicated data and spatial surfaces
simulated_data() simulated_surface()
Extract a simulated dataset or surface
simulated_values()
Extract simulated values in tidy form
print(<RiskMap_simulation_model>) print(<RiskMap_simulation>)
Print a simulation model or simulations
plot_simulation() plot(<RiskMap_simulation>)
Map a simulation
plot_simulated_surface() plot(<RiskMap_simulated_surface>)
Map a simulated surface

Datasets

Data used in the examples and in the book.

abund_sma
Female Culex pipiens abundance (collections) in the Sacramento Metropolitan Area
anopheles
Anopheles mosquitoes in Southern Cameroon
galicia
Heavy metal biomonitoring in Galicia
infect_sma
West Nile virus pool tests for female Culex pipiens in the Sacramento Metropolitan Area
italy_sim
Simulated dataset on the Italian peninsula
liberia
River-blindness in Liberia
loaloa
Loa loa prevalence data from 197 village surveys
malkenya
Malaria Transmission in the Western Kenyan Highlands
malnutrition
Malnutrition in Ghana
tz_covariates
Covariates Dataset for Malaria Prediction in Tanzania
tz_malaria
Malaria Dataset from Tanzania Demographic Health Surveys 2015

Messages, conditions and progress

Control what RiskMap reports while it works, and catch its errors and warnings by class.

riskmap_conditions
Conditions raised by RiskMap
riskmap_progress
Progress of long computations

Building blocks

The Matern correlation function of the spatial Gaussian process.

matern_correlation()
Matern Correlation Function