ebase_years {EBASE} | R Documentation |
Estuarine Bayesian Single-station Estimation method for ecosystem metabolism for long time series
Description
Estuarine Bayesian Single-station Estimation method for ecosystem metabolism for long time series
Usage
ebase_years(
dat,
Z,
interval,
ndays = 1,
aprior = c(4, 2),
rprior = c(300, 150),
bprior = c(0.251, 0.125),
bmax = 0.502,
nogas = FALSE,
doave = TRUE,
maxinterp = 43200/interval,
n.iter = 10000,
update.chains = TRUE,
n.burnin = n.iter * 0.5,
n.chains = 3,
n.thin = 10,
model_file = NULL,
ncores = NULL,
quiet = TRUE,
maxtry = 5
)
Arguments
dat |
input data frame |
Z |
numeric as single value for water column depth (m) or vector equal in length to number of rows in |
interval |
timestep interval in seconds |
ndays |
numeric for number of days in |
aprior |
numeric vector of length two indicating the mean and standard deviation for the prior distribution of the a parameter, see details |
rprior |
numeric vector of length two indicating the mean and standard deviation for the prior distribution of the R parameter, see details |
bprior |
numeric vector of length two indicating the mean and standard deviation for the prior distribution of the b parameter, see details |
bmax |
numeric value for the upper limit on the prior distribution for |
nogas |
logical indicating if gas exchange is not included in the metabolic model, see details |
doave |
logical indicating if the average dissolved oxygen concentration is used as the starting value for the estimation (default), otherwise the first observation will be used if |
maxinterp |
numeric value for minimum number of continuous observations that must not be interpolated within a group defined by |
n.iter |
number of MCMC iterations, passed to |
update.chains |
logical to run |
n.burnin |
number of MCMC chains to delete, passed to |
n.chains |
number of MCMC chains to run, passed to |
n.thin |
number of nth iterations to save for each chain, passed to |
model_file |
|
ncores |
numeric for number of cores to use for parallel processing, use |
quiet |
logical to suppress progress messages to the console |
maxtry |
numeric for maximum number of times to retry the model if it fails |
Details
ebase
is run for each year in the supplied data. This facilitates running ebase
on long time series by running the model sequentially on each year of data, with progress messages printed to the console if quiet = FALSE
. The model run for each year will restart if it fails, up to maxtry
times, after which processing continues with the next year. The model is run in parallel using the number of cores used set by ncores
. If ncores = NULL
, sequential processing is used. All other arguments are passed to ebase
.
Similar results can be obtained by running ebase
on the entire data set, but this function is useful for long time series where the model may fail for some years, e.g., when weather data may be missing for some years.
Value
Output identical to that returned by ebase
, where the results for each year are appended to the data frame as the function progresses through the years. Note that the grp
column that specifies the optimization period defined by ndays
is unique to each year, e.g., values will be repeated across years.
Examples
# get one day of data
dat <- exdat[as.Date(exdat$DateTimeStamp, tz = 'America/Jamaica') == as.Date('2012-06-01'), ]
# run ebase, use more chains and iterations for a better fit, update.chains as T
ebase_years(dat, Z = 1.85, interval = 900, n.chains = 2, n.iter = 50,
update.chains = FALSE)