A model_name concisely specifies the structure of a metabolism model.
From a model_name, an appropriate set of model specifications
(parameters and runtime options) can be generated with specs().
From a complete specs list, a metabolism model can be run with
metab().
Usage
mm_name(
type = c("mle", "bayes", "night", "Kmodel", "sim"),
pool_K600 = c("none", "normal", "normal_sdzero", "normal_sdfixed", "linear",
"linear_sdzero", "linear_sdfixed", "binned", "binned_sdzero", "binned_sdfixed",
"complete"),
err_obs_iid = c(TRUE, FALSE),
err_proc_acor = c(FALSE, TRUE),
err_proc_acor_light = c(FALSE, TRUE),
err_proc_iid = c(FALSE, TRUE),
err_proc_GPP = c(FALSE, TRUE),
ode_method = c("trapezoid", "euler", "rk2", "lsoda", "lsode", "lsodes", "lsodar",
"vode", "daspk", "rk4", "ode23", "ode45", "radau", "bdf", "bdf_d", "adams",
"impAdams", "impAdams_d", "Euler", "pairmeans", "NA"),
GPP_fun = c("linlight", "satlight", "satlightq10temp", "NA"),
ER_fun = c("constant", "q10temp", "NA"),
deficit_src = c("DO_mod", "DO_obs", "DO_obs_filter", "NA"),
engine = c("stan", "nlm", "lm", "mean", "loess", "rnorm"),
check_validity = TRUE
)Arguments
- type
A string specifying the model type:
"mle": Maximum likelihood estimation; seemetab_mle()."bayes": Bayesian hierarchical modeling; seemetab_bayes()."night": Nighttime regression; seemetab_night()."Kmodel": Regression of dailyK600.dailyestimates against discharge, time, or other predictors; seemetab_Kmodel()."sim": Simulation ofDO.obsdata; seemetab_sim().
- pool_K600
A string specifying how to pool information among days for more consistent daily K600 estimates. See K600 pooling for details:
"none": Do not pool K600."normal": UseK₆₀₀ ∼ N(μ, σ)."linear": UseK₆₀₀ ∼ N(B[0] + B[1] × Q, σ)."binned": UseK₆₀₀ ∼ N(B[Q_bin], σ), whereμ ∼ N(mu_mu, mu_sigma)andσ ∼ N(sigma_mu, sigma_sigma)."complete": Use complete pooling fortype = "Kmodel", generally between preceding K estimates and subsequent GPP and ER estimates.
- err_obs_iid
A logical. Should IID observation error be included? If not, the model will be fit to the differences in successive DO measurements, rather than to the DO measurements themselves.
- err_proc_acor
A logical. Should autocorrelated process error (with the autocorrelation term
phifitted) be included? For multi-day Bayesian process-error models, the AR likelihood continues across day boundaries.- err_proc_acor_light
A logical. Should the innovation standard deviation of autocorrelated process error increase linearly with the fraction of each day's light occurring at that timestep? Only available when
err_proc_acor = TRUE.- err_proc_iid
A logical. Should IID process error be included?
- err_proc_GPP
A logical. Should IID process error in GPP be included? This kind of error occurs only during the day and is used to adjust GPP before passing it into the dDO/dt equation.
GPP_instis the corrected GPP, andGPP_inst_partialcontains the pre-adjustment estimates.- ode_method
A string specifying the method used to solve the ordinary differential equation for DO:
"euler"(formerly"Euler"): Use conditions at the start of each timestep."trapezoid"(formerly"pairmeans"): Use mean conditions across each timestep.For
type = "mle","rk2"and methods accepted bydeSolve::ode()are also available. Many have not been extensively tested with streamMetabolizer models.
- GPP_fun
A string specifying how gross primary productivity (GPP) varies within each day:
"linlight":GPP(t) = GPP.daily * light(t) / mean.light.GPP.dailyis partitioned among timesteps by their fraction of the day's average light."satlight":GPP(t) = Pmax * tanh(alpha * light(t) / Pmax), wherePmaxis the maximum possible GPP andalphadescribes the initial increase with light."satlightq10temp": The saturating light model multiplied by1.036 ^ (temp.water(t) - 20).NA: Do not estimate GPP; applicable only totype = "Kmodel".
- ER_fun
A string specifying how ecosystem respiration (ER) varies within each day:
"constant":ER(t) = ER.daily."q10temp":ER(t) = ER20 * 1.045 ^ (temp.water(t) - 20), whereER20is ER at 20 degrees C.NA: Do not estimate ER; applicable only totype = "Kmodel".
- deficit_src
A string specifying the DO estimate used to compute the DO deficit:
"DO_mod": UseDO.sat(t) − DO_mod(t), the difference between the equilibrium-saturation value and the current best estimate of the true DO concentration at that time."DO_obs": UseDO.sat(t) − DO.obs(t)."DO_obs_filter": SmoothDO.obsbefore nighttime regression; applicable only totype = "night".NA: Do not estimate DO deficit; applicable only totype = "Kmodel".
- engine
A string specifying the fitting engine. Valid combinations are
"nlm"for MLE,"stan"for Bayesian models,"lm"for nighttime regression,"mean","lm", or"loess"for K models, and"rnorm"for simulations.- check_validity
A logical. If
TRUE, check the resulting name againstmm_valid_names(type).
Details
While the usage shows all valid values for each argument, not all
argument combinations are valid; the combination will also be checked if
check_validity = TRUE. For arguments not explicitly specified, defaults
depend on the value of type: any argument that is not explicitly
supplied (besides type and check_validity) will default to the
values indicated by mm_parse_name(mm_valid_names(type)[1]).
K600 pooling
Here are the essential model lines (in Stan language) that distinguish the K pooling options.
pool_K600 | Model code |
none | K600_daily ~ normal(K600_daily_mu, K600_daily_sigma) |
normal | K600_daily ~ normal(K600_daily_mu, K600_daily_sigma) |
K600_daily_mu ~ normal(K600_daily_mu_mu, K600_daily_mu_sigma) | |
K600_daily_sigma ~ gamma(K600_daily_sigma_shape, K600_daily_sigma_rate) | |
linear | K600_daily_pred <- K600_daily_beta[1] + K600_daily_beta[2] * discharge_daily |
K600_daily ~ normal(K600_daily_pred, K600_daily_sigma) | |
K600_daily_beta ~ normal(K600_daily_beta_mu, K600_daily_beta_sigma) | |
K600_daily_sigma ~ gamma(K600_daily_sigma_shape, K600_daily_sigma_rate) | |
binned | K600_daily_pred <- K600_daily_beta[Q_bin_daily] |
K600_daily ~ normal(K600_daily_pred, K600_daily_sigma) | |
K600_daily_beta ~ normal(K600_daily_beta_mu, K600_daily_beta_sigma) | |
K600_daily_sigma ~ gamma(K600_daily_sigma_shape, K600_daily_sigma_rate) | |
complete | This option refers to complete pooling via
metab_Kmodel in conjunction with preceding |
estimates of K
(e.g., by metab_mle or metab_night) and subsequent estimates of
GPP and ER | |
(e.g., by metab_mle with daily K600 values
specified) |
See also
The converse of this function is mm_parse_name().
Examples
mm_name("mle")
#> [1] "m_np_oi_tr_plrckm.nlm"
mm_name("mle", GPP_fun = "satlight", ER_fun = "q10temp")
#> [1] "m_np_oi_tr_psrqkm.nlm"
mm_name("night")
#> [1] "n_np_pi_eu_rckf.lm"
mm_name("sim", err_proc_acor = TRUE)
#> [1] "s_np_oipcpi_tr_plrckm.rnorm"
mm_name("bayes", pool_K600 = "binned")
#> [1] "b_Kb_oipi_tr_plrckm.stan"
mm_name("bayes",
err_obs_iid = FALSE,
err_proc_acor = TRUE,
err_proc_acor_light = TRUE,
err_proc_iid = FALSE,
deficit_src = "DO_obs"
)
#> [1] "b_np_pclv_tr_plrcko.stan"