def mc_cor(self, mc_cov_mat=None, method='inse', adjust=False, b=None, r=3): if mc_cov_mat is None: return st.mc_cor(self.get_samples(), method=method, adjust=adjust, b=b, r=r, rowvar=False) else: return st.cor_from_cov(mc_cov_mat)
def mc_cor(self, mc_cov_mat=None, method='inse', adjust=False, b=None, r=3): return np.stack([ st.mc_cor(self.get_chain(i, key='sample'), method=method, adjust=adjust, b=b, r=r, rowvar=False) if mc_cov_mat is None else st.cor_from_cov(mc_cov_mat[i]) for i in range(self.num_chains()) ])
# Examples of empirical correlation matrix computation using cor_from_cov function # %% Load packages import numpy as np from kanga.stats import cor_from_cov # %% Read chains chains = np.genfromtxt('chain01.csv', delimiter=',') num_iters, num_pars = chains.shape # %% Compute correlation matrix via numpy cor_from_cov function np_cor_matrix = cor_from_cov(np.cov(chains, rowvar=False)) print('Correlation matrix based on cor_from_cov function:\n{}'.format( np_cor_matrix))