knitr::opts_chunk$set(echo = TRUE)
options(width=80)
library(streamMetabolizer)

Basic model types in streamMetabolizer

Many model structures are available in the streamMetabolizer package. These fall into three general types:

Two additional model types can be useful in specific situations:

Specific model structure

A complete specification of a model structure begins with a basic type but also includes other information about the model error assumptions, any hierarchical components, the numerical integration method, the process equations used to describe GPP and ER, and more. A model structure is fully specified by a concise if cryptic model name. Examples are "b_np_oipi_tr_plrckm.stan" and "m_np_oi_tr_plrckm.nlm". You never need to remember these concise names; instead, you can construct and interpret such names using the mm_name and mm_parse_name functions, respectively.

Setting a model name

The mm_name() function creates a cryptic (but complete and concise) model name from several options that you can specify. For example:

mm_name(type='bayes') # the default Bayesian model
mm_name(type='bayes', pool_K600='normal') # a Bayesian model with simple pooling of K600 to a shared mean
mm_name(type='mle') # the default MLE model
mm_name(type='mle', ode_method='euler') # an MLE model with a simpler ode_method

See the help file at ?mm_name to learn about the structural options that you can adjust.

Interpreting a model name

The mm_parse_name() function splits a cryptic model name into its component features. For example:

mm_parse_name(c('b_np_oipi_tr_plrckm.stan', 'm_np_pi_tr_psrqkm.nlm'))

See the help file at ?mm_parse_name, and refer again to ?mm_name for definitions of the column names in the output of mm_parse_name.

Listing all the options

You can see the full list of available model structures by calling mm_valid_names() (here we'll just print a sampling of the full list):

valid_names <- mm_valid_names(type=c('bayes','mle','night'))
length(valid_names)
c(valid_names[seq(1,length(valid_names),length.out=20)], '...')

Using a model name

Once you have a model name in hand, pass that name to metab() to fit a model with the selected structure. See the Quickstart tutorial for more.



USGS-R/streamMetabolizer documentation built on Aug. 15, 2023, 7:50 a.m.