check_gaussian_convergence {topolow} | R Documentation |
Check Multivariate Gaussian Convergence
Description
Assesses convergence of multivariate samples by monitoring changes in mean vector and covariance matrix over a sliding window. Useful for checking stability of parameter distributions in optimization or sampling.
Usage
check_gaussian_convergence(data, window_size = 300, tolerance = 0.01)
Arguments
data |
Matrix or data frame of samples where columns are parameters |
window_size |
Integer size of sliding window for statistics |
tolerance |
Numeric convergence threshold for relative changes |
Value
An object of class topolow_convergence
containing diagnostics about the convergence of the multivariate samples. This list includes:
converged |
A logical flag, |
mean_converged |
A logical flag, |
cov_converged |
A logical flag, |
final_mean |
The mean vector calculated from the last |
final_cov |
The covariance matrix calculated from the last |
mean_history |
A matrix tracking the history of the running mean of each parameter. |
cov_changes |
A numeric vector of the relative changes in the Frobenius norm of the covariance matrix. |
param_names |
The names of the parameters (columns) from the input data. |
Examples
# Assuming 'chain_data' is a data frame with samples
chain_data <- as.data.frame(matrix(rnorm(500 * 4), ncol = 4))
colnames(chain_data) <- c("log_N", "log_k0", "log_cooling_rate", "log_c_repulsion")
conv_results <- check_gaussian_convergence(chain_data)
print(conv_results) # Shows summary
# The plot method for this object would create convergence plots.
# plot(conv_results)