Learn R Programming

MetricGraph (version 1.6.0)

Random Fields on Metric Graphs

Description

Facilitates creation and manipulation of metric graphs, such as street or river networks. Further facilitates operations and visualizations of data on metric graphs, and the creation of a large class of random fields and stochastic partial differential equations on such spaces. These random fields can be used for simulation, prediction and inference. In particular, linear mixed effects models including random field components can be fitted to data based on computationally efficient sparse matrix representations. Interfaces to the R packages 'INLA' and 'inlabru' are also provided, which facilitate working with Bayesian statistical models on metric graphs. The main references for the methods are Bolin, Simas and Wallin (2024) , Bolin, Kovacs, Kumar and Simas (2023) and Bolin, Simas and Wallin (2023) and .

Copy Link

Version

Install

install.packages('MetricGraph')

Monthly Downloads

350

Version

1.6.0

License

GPL (>= 2)

Maintainer

David Bolin

Last Published

May 6th, 2026

Functions in MetricGraph (1.6.0)

graph_bru_process_data

Prepare data frames or data lists to be used with 'inlabru' in metric graphs
graph_spde_make_A

Deprecated - Observation/prediction matrices for 'SPDE' models
graph_starting_values

Starting values for random field models on metric graphs
linnet.to.graph

Convert a linnet object to a metric graph object
graph_lgcp_sim

Simulate log-Gaussian Cox processes on metric graphs
graph_data_spde

Data extraction for 'spde' models
graph_spde_basis

Deprecated - Observation/prediction matrices for 'SPDE' models
lgcp_graph

Fit log-Gaussian Cox process models on metric graphs
graph_spde

'INLA' implementation of Whittle-Matérn fields for metric graphs
graph_components

Connected components of metric graph
graph_lme

Metric graph linear mixed effects models
%>%

Pipe operator
make_Q_spacetime

Space-time precision operator discretization
pems

Traffic speed data from San Jose, California
metric_graph

Metric graph
make_Q_euler

Space-time precision operator Euler discretization
logo_lines

Create lines for package name
pems_repl

Traffic speed data with replicates from San Jose, California
psp.to.graph

Convert a psp object to a metric graph object
process_rspde_predictions

Process predictions of rspde_metric_graph objects obtained by using inlabru
mutate.metric_graph_data

A version of dplyr::mutate() function for datasets on metric graphs
sample_spde

Samples a Whittle-Matérn field on a metric graph
predict.rspde_metric_graph

Predict method for 'inlabru' fits on Metric Graphs for 'rSPDE' models
stlpp.to.graph

Convert an stlpp object to a metric graph object
plot.graph_bru_pred

Plot of predicted values with 'inlabru'
plot.graph_bru_proc_pred

Plot of processed predicted values with 'inlabru'
posterior_crossvalidation

Cross-validation for graph_lme models assuming observations at the vertices of metric graphs
spde_covariance

Covariance function for Whittle-Matérn fields
spde_metric_graph_result

Metric graph SPDE result extraction from 'INLA' estimation results
posterior_crossvalidation_loo

Leave-one-out pseudo-crossvalidation for graph_lme models assuming observations at the vertices of metric graphs
match_mesh_data

Match Data Frame Rows to Graph Mesh Order
select.metric_graph_data

A version of dplyr::select() function for datasets on metric graphs
summary.graph_lme

Summary Method for graph_lme Objects
summary.metric_graph

Summary Method for metric_graph Objects
selected_inv

Selected Inverse Calculation
precompute_lgcp_graph

Precompute expensive quantities for efficient LGCP model fitting
summarise.metric_graph_data

A version of dplyr::summarise() function for datasets on metric graphs
simulate_spacetime

space-time simulation based on implicit Euler discretization in time
simulate.graph_lme

Simulation of models on metric graphs
predict.graph_lme

Prediction for a mixed effects regression model on a metric graph
summary.metric_graph_spde_result

Summary for posteriors of field parameters for an inla_rspde model from a rspde.result object
predict.inla_metric_graph_spde

Predict method for 'inlabru' fits on Metric Graphs
spde_precision

Precision matrix for Whittle-Matérn fields
update_graph

Update an older version metric graph to the current package version
spde_variance

Variancefor Whittle-Matérn fields
drop_na.metric_graph_data

A version of tidyr::drop_na() function for datasets on metric graphs
glance.graph_lme

Glance at a graph_lme object
MetricGraph-package

Gaussian processes on metric graphs
exp_covariance

Exponential covariance function
augment.graph_lme

Augment data with information from a graph_lme object
gg_df.metric_graph_spde_result

Data frame for metric_graph_spde_result objects to be used in 'ggplot2'
bru_mapper.inla_metric_graph_spde

Metric graph 'inlabru' mapper
cross_validation

Perform cross-validation on a list of fitted inlabru models on metric graphs.
filter.metric_graph_data

A version of dplyr::filter() function for datasets on metric graphs