Learn R Programming

hmer

Overview

The goal of hmer is to make the process of history matching and emulation accessible and easily usable by modellers, particularly in epidemiology. The central object of the process is an Emulator: a statistical approximation for the output of a complex (and often expensive) model that, given a relatively small number of model evaluations, can give predictions of the model output at unseen points with the appropriate uncertainty built-in. Using these we may follow a process of ‘history matching’, where unfeasible parts of the parameter space are ruled out. Sampling parameter sets from the remaining region allows us to train more accurate emulators, which allow us to remove more of the space, and so on. The hmer package contains tools for the automated construction of emulators, visualisations for diagnostic checks and exploration of parameter space, and a means by which new points can be proposed.

Installation

You can install the development version of hmer from GitHub with:

# install.packages("devtools")
devtools::install_github("andy-iskauskas/hmer")

Example

The three core functions of the package are called below, using built-in toy data.

library(hmer)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
## Train a set of emulators to data
ems <- emulator_from_data(input_data = SIRSample$training,
                          output_names = names(SIREmulators$targets),
                          ranges = list(aSI = c(0.1, 0.8), aIR = c(0, 0.5), aSR = c(0, 0.05)))
## Perform diagnostics on the emulators
validation <- validation_diagnostics(ems, SIREmulators$targets, SIRSample$validation, plt = FALSE)
## Propose new points from the emulators
new_points <- generate_new_design(ems, 50, SIREmulators$targets)

Learning Emulation and History Matching

There is a wealth of published information on Bayes Linear emulation, history matching, and the more general framework of uncertainty quantification, upon which this package is based. The easiest way to learn how to use the hmer package, however, is to look through the vignettes within.

browseVignettes("hmer")
vignette("low-dimensional-examples", package = 'hmer')
  • Low-dimensional examples low-dimensional-examples introduces the basics of emulation and history matching and how to use hmer in some low-dimensional toy models;

  • Demonstration demonstrating-the-hmer-package serves as a broad overview of most of the functions in the package;

  • Stochastic and Bimodal Emulation stochasticandbimodalemulation introduces the basics of dealing with stochastic systems, and identifying bimodality;

  • The “Emulation Handbook” emulationhandbook details some common problems and considerations that occur when using the framework, and serves as a broad FAQ for problems encountered.

Copy Link

Version

Install

install.packages('hmer')

Monthly Downloads

195

Version

1.6.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Andrew Iskauskas

Last Published

November 28th, 2025

Functions in hmer (1.6.2)

emulator_plot

Plot Emulator Outputs
exp_sq

Exponential squared correlation function
gamma_exp

Gamma-exponential correlation function
full_wave

Automatic Wave Calculation
directional_proposal

Emulated Derivative Point Proposal
export_emulator_to_json

Export Emulators
emulator_from_data

Generate Emulators from Data
generate_new_runs

Generate Proposal Points
generate_new_design

Generate Proposal Points
effect_strength

Find Effect Strength of Active Variables
matern

Matern correlation function
import_emulator_from_json

Import JSON Emulator Data
get_diagnostic

Diagnostic Tests for Emulators
idemc

IDEMC Point Generation
nth_implausible

nth Maximum Implausibility
hit_by_wave

Output Hit Summary
orn_uhl

Ornstein-Uhlenbeck correlation function
maximin_sample

Generate Maximin Sample of Points
individual_errors

Predictive Error Plots
output_plot

Emulator Expectation Against Target Outputs
prin_vars

Determine Principle Outputs
space_removal

Percentage of Space Removed
plot_lattice

Plot Lattice of Emulator Implausibilities
rat_quad

Rational Quadratic correlation function
problem_data

Data for an interesting emulation problem
space_removed

Space Removal Diagnostics
plot_actives

Active variable plotting
simulator_plot

Plot simulator outputs for multiple waves
plot_wrap

Plot proposed points
residual_diag

Emulator Regression Residuals
summary_diag

Summary Statistics for Emulators
validation_pairs

Validation Set Diagnostics and Implausibility
wave_values

Multiple Wave Output Plotting
validation_diagnostics

Emulator Diagnostics
variance_emulator_from_data

Variance Emulator Creation (Deprecated)
wave_dependencies

Multiple Wave Inputs vs Outputs
standard_errors

Standardized Error Diagnostics
subset_emulators

Subsetting for Bimodal/Variance Emulators
wave_points

Multiple Wave Point Plotting
Emulator

Bayes Linear Emulator
BirthDeath

Birth-Death Model Results
Proto_emulator

Prototype Class for Emulator-like Objects
Correlator

Correlation Structure
HierarchicalEmulator

Hierarchical Bayes Linear Emulator
SIRMultiWaveData

Sample Multi-wave Results
SIREmulators

Sample Emulators
SIRImplausibility

Sample Implausibility Data
SIRSample

Sample SIR data
SIRMultiWaveEmulators

Sample Multi-wave Emulators
directional_deriv

Derivative inner product
analyze_diagnostic

Diagnostic Analysis for Emulators
diagnostic_pass

Automated Diagnostics and Modifications
comparison_diag

Comparison Diagnostics
bimodal_emulator_from_data

Bimodal Emulation
diagnostic_wrap

Diagnostic plots for wave outputs
collect_emulators

Collect and order emulators
classification_diag

Classification Diagnostics
behaviour_plot

Output Plotting
SIR_stochastic

Stochastic SIR Data