diagnostic_iter_thres:, :] chain_array.vals['accepted'] = chain_array.vals['accepted'][ diagnostic_iter_thres:] # %% Plot traces of simulated chain for i in range(model.num_params()): ps.trace(chain_array.get_param(i), title=r'Traceplot of $\theta_{{{}}}$'.format(i + 1), xlabel='Iteration', ylabel='Parameter value') # %% Plot running means of simulated chain for i in range(model.num_params()): ps.running_mean( chain_array.get_param(i), title=r'Running mean plot of parameter $\theta_{{{}}}$'.format(i + 1), xlabel='Iteration', ylabel='Running mean') # %% Plot histograms of marginals of simulated chain for i in range(model.num_params()): ps.hist(chain_array.get_param(i), bins=30, density=True, title=r'Histogram of parameter $\theta_{{{}}}$'.format(i + 1), xlabel='Parameter value', ylabel='Parameter relative frequency')
# %% Load packages from numpy import genfromtxt import kanga.plots as ps # %% Read chains chains = genfromtxt('chain01.csv', delimiter=',') num_iters, num_pars = chains.shape # %% Histogram of a single chain with default hist input arguments ps.hist(chains[:, 0]) # %% Histogram of a single chain with relative frequencies ps.hist(chains[:, 0], density=True) # %% Histogram of a single chain with some non-default hist input arguments ps.hist(chains[:, 0], bins=25, xrange=[-10, 10], linewidth=2, density=True, edgecolor='black', title=r'Histogram of parameter $\theta_{{{}}}$'.format(1), xlabel='Parameter value',