Predict the discharge for given stage values based on a discharge rating curve model object.

# S3 method for plm0
predict(object, ..., newdata = NULL, wide = FALSE)

# S3 method for plm
predict(object, ..., newdata = NULL, wide = FALSE)

# S3 method for gplm0
predict(object, ..., newdata = NULL, wide = FALSE)

# S3 method for gplm
predict(object, ..., newdata = NULL, wide = FALSE)

Arguments

object

an object of class "plm0", "plm", "gplm0" or "gplm".

...

not used in this function

newdata

a numeric vector of stage values for which to predict. If omitted, the stage values in the data are used.

wide

a logical value denoting whether to produce a wide prediction output.If TRUE, then the output is a table with median prediction values for an equally spaced grid of stages with 1 cm increments, each row containing predictions in a decimeter range of stages.

Value

an object of class "data.frame" with four columns, h (stage), lower (2.5% posterior predictive quantile), median (50% posterior predictive quantile), upper (97.5% posterior predictive quantile). If wide=TRUE, a matrix as described above (see wide parameter) is returned.

Functions

  • predict(plm0): Predict method for plm0

  • predict(plm): Predict method for plm

  • predict(gplm0): Predict method for gplm0

  • predict(gplm): Predict method for gplm

See also

plm0, plm, gplm0 and gplm for fitting a discharge rating curve and summary.plm0, summary.plm, summary.gplm0 and summary.gplm for summaries. It is also useful to look at plot.plm0, plot.plm, plot.gplm0 and plot.gplm to help visualize all aspects of the fitted discharge rating curve. Additionally, spread_draws and spread_draws help working directly with the MCMC samples.

Examples

# \donttest{
data(krokfors)
set.seed(1)
plm0.fit <- plm0(formula=Q~W,data=krokfors,h_max=10,num_cores=2)
#predict rating curve on a equally 10 cm spaced grid from 9 to 10 meters
predict(plm0.fit,newdata=seq(9,10,by=0.1))
#>       h     lower    median     upper
#> 1   9.0  2.442127  3.634252  5.373885
#> 2   9.1  2.978317  4.454114  6.609402
#> 3   9.2  3.598533  5.382946  8.014939
#> 4   9.3  4.311532  6.430511  9.608327
#> 5   9.4  5.065276  7.634351 11.422039
#> 6   9.5  5.940643  8.948820 13.322588
#> 7   9.6  6.871191 10.406507 15.504703
#> 8   9.7  7.904699 11.981235 17.862960
#> 9   9.8  9.011730 13.718899 20.583249
#> 10  9.9 10.271354 15.631888 23.650872
#> 11 10.0 11.452520 17.712548 26.780439
# }