A single distribution fit to a record, optionally censored (via analysis_data()) and
optionally nonstationary (via trend()). This is the workhorse model behind
univariate_analysis().
Usage
model_univariate(
family,
data,
trends = NULL,
parameters = NULL,
parameter_values = NULL,
use_default_flat_priors = NULL
)Arguments
- family
distribution family name; see
distribution_names().- data
a numeric vector of observations, or an
analysis_data()frame carrying censored observations.- trends
optional
trend()object or list of them, making the model nonstationary.- parameters
optional
model_parameter()object or list of them, setting bounds, fixed flags, priors, or starting values.- parameter_values
optional numeric vector of all parameter values, applied last.
- use_default_flat_priors
logical; set
FALSEalongside a custom prior.
Examples
peaks <- c(12500, 15300, 8900, 22100, 18700, 14200, 9800, 28500, 17400, 11600)
model_univariate("LogPearsonTypeIII", peaks)
#> <corehydro_model> univariate_distribution: LogPearsonTypeIII
#> data: 10 exact observations
# Censored: two historical floods known only within a range.
d <- analysis_data(
exact = peaks,
interval = data.frame(
index = c(10, 11), lower = c(30000, 26000),
value = c(35000, 29000), upper = c(40000, 32000)
)
)
model_univariate("LogPearsonTypeIII", d)
#> <corehydro_model> univariate_distribution: LogPearsonTypeIII
#> data: <corehydro_data> 10 exact, 2 interval
# Nonstationary: a linear trend on the location parameter.
model_univariate("Normal", peaks, trends = trend("mean", "Linear"))
#> <corehydro_model> univariate_distribution: Normal
#> data: 10 exact observations
#> trends: Linear on parameter 1