Skip to contents

Fit a stage-discharge rating curve with a Bayesian MCMC and return the predicted-discharge mode/mean curve + credible band across a stage grid. Wraps the shared C++ RatingCurveAnalysis.

Usage

rating_curve_analysis(
  stage,
  discharge,
  segments = 1L,
  stage_bins = NULL,
  min_stage = NULL,
  max_stage = NULL,
  sampler = "DEMCz",
  iterations = 3000L,
  output_length = 10000L,
  credible_level = 0.9,
  seed = 12345L,
  number_of_chains = 4L,
  thinning_interval = -1L
)

Arguments

stage, discharge

numeric vectors of date-aligned stage / discharge observations.

segments

number of rating-curve segments (default 1).

stage_bins

number of stage grid points (default NULL, keeps the data-derived default).

min_stage, max_stage

optional stage-grid bounds (default NULL, data-derived).

sampler

MCMC sampler: "DEMCz" (default), "DEMCzs", "ARWMH", or "NUTS".

iterations

number of post-warmup MCMC iterations.

output_length

number of posterior samples used to build the credible band.

credible_level

credible-interval width (e.g. 0.90 for a 90% band).

seed

PRNG seed for the sampler (fixed for reproducibility).

number_of_chains

number of MCMC chains (default 4).

thinning_interval

MCMC thinning interval; -1 (default) keeps the sampler's own default.

Value

A named list: parameters, mode_curve, mean_curve, lower_ci, upper_ci, aic, bic, dic, rmse.