Estuarine Bayesian Single-station Estimation method for ecosystem metabolism for long time series
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
)
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.
input data frame
numeric as single value for water column depth (m) or vector equal in length to number of rows in dat
timestep interval in seconds
numeric for number of days in dat
for optimizing the metabolic equation, see details
numeric vector of length two indicating the mean and standard deviation for the prior distribution of the a parameter, see details
numeric vector of length two indicating the mean and standard deviation for the prior distribution of the R parameter, see details
numeric vector of length two indicating the mean and standard deviation for the prior distribution of the b parameter, see details
numeric value for the upper limit on the prior distribution for bprior
, set as twice the default value of the mean
logical indicating if gas exchange is not included in the metabolic model, see details
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 FALSE
, see details
numeric value for minimum number of continuous observations that must not be interpolated within a group defined by ndays
to assign as NA
in output, see details
number of MCMC iterations, passed to jags
logical to run metab_update
if chains do not converge
number of MCMC chains to delete, passed to jags
number of MCMC chains to run, passed to jags
number of nth iterations to save for each chain, passed to jags
NULL
to use the model file included with the package or a path to a model text file can be used
numeric for number of cores to use for parallel processing, use NULL
to suppress
logical to suppress progress messages to the console
numeric for maximum number of times to retry the model if it fails
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.
# 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)
Run the code above in your browser using DataLab