plot.topolow_convergence {topolow} | R Documentation |
Plot Method for Convergence Diagnostics
Description
Creates visualization of convergence diagnostics from Monte Carlo sampling, including parameter mean trajectories and covariance matrix stability over iterations. Helps assess whether parameter estimation has converged to stable distributions.
Usage
## S3 method for class 'topolow_convergence'
plot(x, param_names = NULL, ...)
Arguments
x |
A topolow_convergence object from check_gaussian_convergence(). |
param_names |
Optional character vector of parameter names to use in plot titles. If NULL (default), uses the param_names from the topolow_convergence object. |
... |
Additional arguments passed to underlying plot functions (currently not used). |
Details
The function generates two types of plots:
Parameter mean plots: Shows how the mean value for each parameter changes over iterations. Stabilization of these plots indicates convergence of parameter distributions.
Covariance change plot: Shows relative changes in the covariance matrix using the Frobenius norm (also called Hilbert-Schmidt norm), which is defined as the square root of the sum of the absolute squares of all matrix elements:
\sqrt{\sum|a_{ij}|^2}
. A decreasing trend approaching zero indicates stable relationships between parameters.
Value
A grid of plots showing convergence metrics.
See Also
check_gaussian_convergence
for generating the convergence object
Examples
# Example with simulated data
chain_data <- data.frame(
log_N = rnorm(1000, mean = 1.5, sd = 0.1),
log_k0 = rnorm(1000, mean = -0.5, sd = 0.2)
)
# Check convergence
results <- check_gaussian_convergence(chain_data)
# Plot diagnostics
plot(results)
# With custom parameter names
plot(results, param_names = c("Dimensions (log)", "Spring constant (log)"))