Predict metabolism from a fitted model.
Source:R/metab_model_interface.R
, R/metab_bayes.R
, R/metab_model.predict_metab.R
predict_metab.Rd
A function in the metab_model_interface. Returns predictions (estimates) of GPP, ER, and K600.
Usage
predict_metab(
metab_model,
date_start = NA,
date_end = NA,
day_start = get_specs(metab_model)$day_start,
day_end = min(day_start + 24, get_specs(metab_model)$day_end),
...,
attach.units = deprecated(),
use_saved = TRUE
)
# S3 method for metab_bayes
predict_metab(
metab_model,
date_start = NA,
date_end = NA,
...,
attach.units = deprecated()
)
# S3 method for metab_model
predict_metab(
metab_model,
date_start = NA,
date_end = NA,
day_start = get_specs(metab_model)$day_start,
day_end = min(day_start + 24, get_specs(metab_model)$day_end),
...,
attach.units = deprecated(),
use_saved = TRUE
)
Arguments
- metab_model
A metabolism model, implementing the metab_model_interface, to use in predicting metabolism
- date_start
Date or a class convertible with as.Date. The first date (inclusive) for which to report metabolism predictions. If NA, no filtering is done.
- date_end
Date or a class convertible with as.Date. The last date (inclusive) for which to report metabolism predictions. If NA, no filtering is done.
- day_start
start time (inclusive) of a day's data in number of hours from the midnight that begins the date. For example, day_start=-1.5 indicates that data describing 2006-06-26 begin at 2006-06-25 22:30, or at the first observation time that occurs after that time if day_start doesn't fall exactly on an observation time. For daily metabolism predictions, day_end - day_start should probably equal 24 so that each day's estimate is representative of a 24-hour period.
- day_end
end time (exclusive) of a day's data in number of hours from the midnight that begins the date. For example, day_end=30 indicates that data describing 2006-06-26 end at the last observation time that occurs before 2006-06-27 06:00. For daily metabolism predictions, day_end - day_start should probably equal 24 so that each day's estimate is representative of a 24-hour period.
- ...
Other arguments passed to class-specific implementations of
predict_metab
- attach.units
(deprecated, effectively FALSE in future) logical. Should units be attached to the output?
- use_saved
logical. Is it OK to use predictions that were saved with the model?
Value
A data.frame of daily metabolism estimates. Columns include:
- GPP
numeric estimate of Gross Primary Production, positive when realistic, \(g O_2 m^{-2} d^{-1}\)
- ER
numeric estimate of Ecosystem Respiration, negative when realistic, \(g O_2 m^{-2} d^{-1}\)
- K600
numeric estimate of the reaeration rate \(d^{-1}\)
Methods (by class)
metab_bayes
: Pulls daily metabolism estimates out of the Stan model results; looks forGPP
orGPP_daily
and forER
orER_daily
among theparams_out
(seespecs
), which means you can save just one (or both) of those sets of daily parameters when running the Stan model. Saving fewer parameters can help models run faster and use less RAM.metab_model
: This implementation is shared by many model types
See also
Other metab_model_interface:
get_data_daily()
,
get_data()
,
get_fitting_time()
,
get_fit()
,
get_info()
,
get_param_names()
,
get_params()
,
get_specs()
,
get_version()
,
predict_DO()
Examples
dat <- data_metab('3', day_start=12, day_end=36)
mm <- metab_night(specs(mm_name('night')), data=dat)
predict_metab(mm)
#> date GPP GPP.lower GPP.upper ER ER.lower ER.upper msgs.fit
#> 1 2012-09-18 0 NA NA -2.122498 -2.351240 -1.893755
#> 2 2012-09-19 0 NA NA -2.927715 -3.233801 -2.621628
#> 3 2012-09-20 0 NA NA -2.125522 -2.305859 -1.945185
#> warnings errors
#> 1
#> 2
#> 3
predict_metab(mm, date_start=get_fit(mm)$date[2])
#> date GPP GPP.lower GPP.upper ER ER.lower ER.upper msgs.fit
#> 1 2012-09-19 0 NA NA -2.927715 -3.233801 -2.621628
#> 2 2012-09-20 0 NA NA -2.125522 -2.305859 -1.945185
#> warnings errors
#> 1
#> 2