Building and running a network model

These functions allow to define the characteristics of a network (topology, initial conditions, …) and the statistical properties of the corresponding model (priors, covariates, …).

Definition of network properties

new_networkModel()

Create an empty network model

set_topo()

Set the topology in a network model.

set_init()

Set initial conditions in a network model

set_obs()

Set observations in a network model

set_steady()

Flag some network compartments as being in a steady state

set_split()

Flag some network compartments as being split compartments

set_half_life()

Set the half-life for radioactive tracers

add_pulse_event()

Register a pulse event on one of the compartment of a topology

Definition of statistical properties

add_covariates()

Add fixed effects of one or several covariates to some parameters.

set_size_family()

Set the distribution family for observed sizes

set_prop_family()

Set the distribution family for observed proportions

set_prior() set_priors()

Set prior(s) for a network model

missing_priors()

Get a table with parameters which are missing priors

Available priors

available_priors()

List the available priors for model parameters

constant_p()

Define a fixed-value prior

uniform_p()

Define a uniform prior

normal_p()

Define a truncated normal prior (on [0;+Inf])

hcauchy_p()

Define a half-Cauchy prior (on [0;+Inf])

scaled_beta_p()

Define a beta prior (on [0;scale])

exponential_p()

Define an exponential prior

gamma_p()

Define a gamma prior

Examining a network model

comps()

Return the compartments of a network model

groups(<networkModel>)

Get the grouping for a networkModel object

params()

Return the parameters of a network model

priors()

Return the tibble containing the priors of a networkModel

prop_family()

Return the distribution family for observed proportions

size_family()

Return the distribution family for observed sizes

topo()

Return the list of topologies, or a unique topology if all identical

ggtopo()

Plot a topology

Running a network model

run_mcmc()

Run a MCMC sampler on a network model using Stan

Post-run functions

These functions allow basic manipulation of the mcmc.list object returned when running a model. Posterior predictive checks can be performed, and network properties such as steady states can be calculated.

Visualization and manipulation of MCMC samples

plot(<networkModel>)

Plot observations/trajectories/predictions from a network model

tidy_mcmc()

Extract a tidy output from an mcmc.list

Math(<mcmc.list>)

Math generics for mcmc.list objects

Ops(<mcmc.list>)

Ops generics for mcmc.list objects

c(<mcmc.list>)

Combine mcmc.list objects

`[`(<networkModelStanfit>)

Subset method for networkModelStanfit objects

mcmc_heatmap()

Draw a heatmap based on the correlations between parameters

Posterior predictive checks

predict(<networkModel>)

Add a column with predictions from a fit

tidy_dpp()

Prepare tidy data and posterior predictions

Network properties

tidy_trajectories()

Build a tidy table with the trajectories for each iteration

tidy_steady_states()

Build a tidy table with the calculated steady states for each iteration

tidy_flows()

Build a tidy table with the flows for each iteration

Visualization of network fluxes

sankey()

Draw a Sankey plot for a network and estimated flows

quick_sankey()

Draw a Sankey plot with basic defaults

ggflows()

A quick-and-dirty way of visualizing relative flows in a network

Simulation toolkit

The package provides functions that can be used to simulate data for a given network topology and some parameter values.

sample_from_prior()

Sample from a prior object

sample_params()

Sample parameter values from priors

set_params()

Set the parameters in a network model

sample_from()

Generate samples from a network model

Datasets

Datasets shipped with the package (example models, example run, and datasets used in the case studies).

Example models and run

aquarium_mod

A simple aquarium network model, ready to run

aquarium_run

An MCMC run from a simple aquarium network model

trini_mod

Network model for nitrogen fluxes in Trinidadian streams (Collins et al. 2016)

Datasets used in the case studies

eelgrass

Eelgrass phosphate incorporation data (McRoy & Barsdate 1970)

lalaja

Dataset for nitrogren fluxes in a Trinidadian mountain stream (Collins 2016)

li2017

Protein degradation in Arabidopsis plants (Li et al. 2017)

Miscellaneous

Those are mostly methods implemented in the package. Typically the package user will not need to call those functions themselves.

Ops(<prior>)

Implementation of the '==' operator for priors

format(<prior>)

Pretty formatting of a prior object

format(<prior_tibble>)

Pretty formatting of a prior_tibble object

obj_sum(<prior>)

Function used for displaying prior object in tibbles

pillar_shaft(<prior>)

Function used for displaying prior object in tibbles

print(<prior>)

Pretty printing of a prior object

print(<prior_tibble>)

Pretty printing of a prior_tibble object

type_sum(<prior>)

Function used for displaying prior object in tibbles

Ops(<topology>)

Ops generics for topology objects

as_tbl_graph(<topology>)

Convert a network topology to a tbl_graph

ggtopo(<networkModel>)

Plot a network topology

ggtopo(<topology>)

Plot a topology

print(<topology>)

Pretty printing of a topology object

Others

as.mcmc.list(<tidy_flows>)

Convert a tidy_flows object to an mcmc.list

as.mcmc.list(<tidy_steady_states>)

Convert a tidy_steady_states object to an mcmc.list

filter(<ppcNetworkModel>)

Filter method for output of tidy_data_and_posterior_predict()

isotracer-package isotracer

The 'isotracer' package

plot(<ready_for_unit_plot>)

Plot output from split_to_unit_plot

posterior_predict(<networkModelStanfit>)

Draw from the posterior predictive distribution of the model outcome

print(<networkModel>)

Print method for networkModel objects

select(<mcmc.list>)

Select parameters based on their names

Miscellaneous

Functions not sorted in the previous categories.

reexports groups select as.mcmc.list varnames %>%

Objects exported from other packages

as_tbl_graph()

Generic for as_tbl_graph()

calculate_steady_state()

Calculate steady-state compartment sizes for a network

delta2prop()

Convert delta notation to proportion of heavy isotope

dic()

Calculate DIC from a model output

filter

Filter (alias for filter function from dplyr)

filter_by_group()

Filter a tibble based on the "group" column

posterior_predict()

Draw from the posterior predictive distribution of the model outcome

project()

Calculate the trajectories of a network model

prop2delta()

Convert isotopic proportions to delta values

stanfit_to_named_mcmclist()

Convert a Stanfit object to a nicely named mcmc.list object

tidy_data()

Extract data from a networkModel object into a tidy tibble.

tidy_posterior_predict()

Draw from the posterior predictive distribution of the model outcome

traceplot()

Plot mcmc.list objects