Fit Bayesian Linear Model
btbr_brm_sediment.RdThis function fits a brm model (see details below) to previously created btbr_sediment_randomsamples.
Arguments
- btbr_rs
A previously created btbr_sediment_randomsamples object.
- linear
Logical. Whether to run without spline or not, TRUE (default).
Details
Below are the model parameter priors for the linear model. The nonlinear model using flat priors only. $$Y_i \sim \text{Beta}(\mu_i, \phi) \\ \text{logit}(\mu_i) = \beta_0 + \beta_1\text{Natural} + \beta_2\text{Roads} + \beta_3\text{Geology} \\ \beta_0=\text{Normal}(0,1) \\ \beta_1,\beta_2=\text{Normal}(0,2) \\ \beta_3=\text{Normal}(0,1) \\ \phi = \text{Gamma}(0.01, 0.01)$$
Examples
if (FALSE) {
data <- btbr_tss()
granitic_dist <- btbr_batch_distribution(data %>% dplyr::filter(geology == 'Granitic'),
value = value_tons_mi2_yr,
method = 'mge')
sedimentary_dist <- btbr_batch_distribution(data %>% dplyr::filter(geology == 'Sedimentary'),
value = value_tons_mi2_yr,
method = 'mge')
btbr_rs <- btbr_sediment_randomsamples(usfs = TRUE,
sedimentary_dist = sedimentary_dist[['lpearson']],
granitic_dist = granitic_dist[['lognorm']])
btbr_sedmod <- btbr_brm_sediment(btbr_rs)
}