Skip to contents

Fit polynomial rating curve

Usage

rc_poly(discharge, stage, ..., data = NULL, degree = 2, variance = var_none())

Arguments

discharge

<data-masking> Discharge: a vector, or an expression evaluated in data, such as a column name.

stage

<data-masking> Stage: a vector, or an expression evaluated in data, such as a column name.

...

Must be empty. Present so that every argument after it has to be named in full.

data

Optional data frame in which discharge and stage are evaluated.

degree

Polynomial degree; positive whole number. Default 2.

variance

[Experimental] How the variance of the gaugings about the curve is modelled: var_none() (or "none", the default), var_prop() (or "prop"), or var_spec() with the variances. See variance.

Value

An rc_poly object; see rating_curve for its contents. The coefficients are named b0, b1, ... by power of stage.

Examples

fit <- rc_poly(discharge, stage, data = thompson, degree = 2)
predict(fit, new_stage = c(1, 3, 6), conflev = 0.95)
#> # A tibble: 3 × 4
#>   stage   fit ci_lwr ci_upr
#>   <dbl> <dbl>  <dbl>  <dbl>
#> 1     1  244.   222.   266.
#> 2     3  835.   816.   855.
#> 3     6 2201.  2181.  2221.