
Fit a Bayesian hierarchical spatial linear model (Pilar 7)
Source:R/pilar7_bayesian_hierarchical.R
bhs_fit.RdThe v2.3.0 activation of the Pilar 7 scaffold. Fits a Bayesian
spatial linear model y_i = x_i' beta + w_i + eps_i with a latent
exponential-correlation Gaussian process on the residual field
and returns full posterior draws.
Arguments
- data
A data frame with the response + covariates + spatial coordinates.
- formula
A
response ~ covariatesformula.- coords
Character length-2 (default
c("lon", "lat")) giving the coordinate columns.- backend
One of
"gibbs"(pure-R Gibbs sampler, default, no external deps),"spBayes"(dispatches tospBayes::spLMwhen available).- nmcmc
Integer; number of MCMC iterations. Default
2000L.- burn
Integer; burn-in to discard. Default
nmcmc %/% 2.- thin
Integer; keep every
thin-th post-burn draw. Default1L.- prior_var_beta
Numeric; Gaussian prior variance on
beta.- prior_ig_a, prior_ig_b
Shape and scale of the inverse-Gamma priors on
sigma^2andtau^2.- phi_range
Numeric length-2; bracket for the profile-MLE of the GP rate parameter
phi. Defaultc(0.01, 10).- seed
Optional RNG seed.
- verbose
Logical.