View source: R/mcmc_freundlichLM.R
mcmc_freundlichLM | R Documentation |
Performs Bayesian parameter estimation using Markov Chain Monte Carlo (MCMC) to estimate the parameters of the Freundlich isotherm based on its linearized form: log(Qe) = log(Kf) + (1/n)log(Ce) This method provides a probabilistic interpretation of the model parameters and accounts for their uncertainties. It supports multiple MCMC chains and computes convergence diagnostics (Gelman-Rubin).
Ce |
Numeric vector of equilibrium concentrations. |
Qe |
Numeric vector of adsorbed amounts. |
burnin |
Integer specifying the number of burn-in iterations (default is 1000). |
mcmc |
Integer specifying the total number of MCMC iterations (default is 5000). |
thin |
Integer specifying the thinning interval (default is 10). |
verbose |
Integer controlling the frequency of progress updates (default is 100). |
plot |
Logical; if TRUE, trace and density plots of the MCMC chains are shown (default is FALSE). |
n_chains |
Number of independent MCMC chains (default = 2). |
seed |
Optional integer for reproducibility. |
A list containing:
An object of class mcmc.list
containing posterior samples from all MCMC chains. Each chain includes samples of the intercept and slope.
Posterior mean estimate of the Freundlich constant (Kf).
Posterior mean estimate of the Freundlich exponent (n).
Posterior mean of (log(Kf)) from the first MCMC chain.
Posterior mean of (1/n) (the slope) from the first MCMC chain.
Posterior standard deviation of (log(Kf)), quantifying uncertainty in the intercept estimate.
Posterior standard deviation of (1/n), quantifying uncertainty in the slope estimate.
95% credible interval for (log(Kf)) from the first MCMC chain, representing the posterior uncertainty in the intercept.
95% credible interval for (1/n) from the first MCMC chain, representing the posterior uncertainty in the slope.
Gelman-Rubin diagnostic output from coda::gelman.diag()
, used to assess convergence of the multiple MCMC chains. A potential scale reduction factor (PSRF) close to 1 indicates good convergence.
Summary statistics of the first MCMC chain, including means, standard deviations, quantiles, and sample sizes for each parameter.
Paul Angelo C. Manlapaz
Gilks, W. R., Richardson, S., & Spiegelhalter, D. J. (1995). Markov Chain Monte Carlo in Practice. Chapman and Hall/CRC.
Ce <- c(0.01353, 0.04648, 0.13239, 0.27714, 0.41600, 0.63607, 0.80435, 1.10327, 1.58223)
Qe <- c(0.03409, 0.06025, 0.10622, 0.12842, 0.15299, 0.15379, 0.15735, 0.15735, 0.16607)
mcmc_freundlichLM(Ce, Qe, burnin = 1000, mcmc = 5000, thin = 10,
verbose = 100, plot = TRUE, n_chains = 2, seed = 123)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.