Description Usage Arguments Details Value References See Also Examples
plm is used to fit a discharge rating curve for paired measurements of stage and discharge using a powerlaw model with variance that varies with stage as described in Hrafnkelsson et al. (2020). See "Details" for a more elaborate description of the model.
1 2 3 4 5 6 7 8 9 
formula 
an object of class "formula", with discharge column name as response and stage column name as a covariate, i.e. of the form 
data 
data.frame containing the variables specified in formula. 
c_param 
stage for which there is zero discharge. If NULL, it is treated as unknown in the model and inferred from the data. 
h_max 
maximum stage to which the rating curve should extrapolate to. If NULL, the maximum stage value in the data is selected as an upper bound. 
parallel 
logical value indicating whether to run the MCMC in parallel or not. Defaults to TRUE. 
num_cores 
integer between 1 and 4 (number of MCMC chains) indicating how many cores to use. Only used if parallel=TRUE. If NULL, the number of cores available on the device is detected automatically. 
forcepoint 
logical vector of the same length as the number of rows in data. If an element at index i is TRUE it indicates that the rating curve should be forced through the ith measurement. Use with care, as this will strongly influence the resulting rating curve. 
The powerlaw model, which is commonly used in hydraulic practice, is of the form
Q=a(hc)^{b}
where Q is discharge, h is stage and a, b and c are unknown constants.
The powerlaw model is here inferred by using a Bayesian hierarchical model. The model is on a logarithmic scale
\log(Q_i) = \log(a) + b \log(h_i  c) + \varepsilon_i, i = 1,...,n
where \varepsilon_i follows a normal distribution with mean zero and variance σ_\varepsilon(h_i)^2 that varies with stage. The error variance, σ_\varepsilon^2(h), of the logdischarge data is modeled as an exponential of a Bspline curve, that is, a linear combination of six Bspline basis functions that are defined over the range of the stage observations. An efficient posterior simulation is achieved by sampling from the joint posterior density of the hyperparameters of the model, and then sampling from the density of the latent parameters conditional on the hyperparameters.
Bayesian inference is based on the posterior density and summary statistics such as the posterior mean and 95% posterior intervals are based on the posterior density. Analytical formulas for these summary statistics are intractable in most cases and thus they are computed by generating samples from the posterior density using a Markov chain Monte Carlo simulation.
plm returns an object of class "plm". An object of class "plm" is a list containing the following components:

a data frame with 2.5%, 50% and 97.5% percentiles of the posterior predictive distribution of the rating curve. 

a data frame with 2.5%, 50% and 97.5% percentiles of the posterior distribution of the mean of the rating curve. Additionally contains columns with r_hat and the effective number of samples for each parameter as defined in Gelman et al. (2013). 

a data frame with 2.5%, 50% and 97.5% percentiles of the posterior distribution of latent and hyperparameters. 

a data frame with 2.5%, 50% and 97.5% percentiles of the posterior of σ_{\varepsilon}. 

a data frame with 2.5%, 50% and 97.5% percentiles of the posterior distribution of the deviance. 

a matrix containing the full thinned posterior samples of the posterior predictive distribution of the rating curve (excluding burnin). 

a matrix containing the full thinned posterior samples of the posterior distribution of the mean of the rating curve (excluding burnin). 

a numeric vector containing the full thinned posterior samples of the posterior distribution of a. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of b. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of c. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of σ_{\varepsilon}. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of η_1. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of η_2. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of η_3. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of η_4. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of η_5. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of η_6. 

a numeric vector containing the full thinned posterior samples of the posterior distribution of the deviance excluding burnin samples. 

deviance at the median value of the parameters. 

number of effective parameters, which is calculated as median(Deviance_posterior) minus D_hat. 

Deviance Information Criterion for the model, calculated as D_hat plus 2*num_effective_parameters. 

a data frame with the autocorrelation of each parameter for different lags. 

proportion of accepted samples in the thinned MCMC chain (excluding burnin). 

object of type "formula" provided by the user. 

data provided by the user, ordered by stage. 

information about the input arguments and the specific parameters used in the MCMC chain. 
Hrafnkelsson, B., Sigurdarson, H., and Gardarsson, S. M. (2020). Generalization of the powerlaw rating curve using hydrodynamic theory and Bayesian hierarchical modeling. arXiv preprint 2010.04769.
Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., and Rubin, D. B. (2013). Bayesian Data Analysis, Third Edition. Chapman & Hall/CRC Texts in Statistical Science. Taylor & Francis.
summary.plm
for summaries, predict.plm
for prediction. It is also useful to look at spread_draws
and plot.plm
to help visualize the full posterior distributions.
1 2 3 4 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.