pymcmcstat.plotting package¶
pymcmcstat.plotting.MCMCPlotting module¶
Created on Wed Jan 31 12:54:16 2018
@author: prmiles
-
class
pymcmcstat.plotting.MCMCPlotting.
Plot
[source]¶ Plotting routines for analyzing sampling chains from MCMC process.
-
pymcmcstat.plotting.MCMCPlotting.
plot_chain_metrics
(chain, name=None, figsizeinches=None)[source]¶ Plot chain metrics for individual chain
- Scatter plot of chain
- Histogram of chain
-
pymcmcstat.plotting.MCMCPlotting.
plot_chain_panel
(chains, names=None, figsizeinches=None, maxpoints=500)[source]¶ Plot sampling chain for each parameter
-
pymcmcstat.plotting.MCMCPlotting.
plot_density_panel
(chains, names=None, hist_on=False, figsizeinches=None)[source]¶ Plot marginal posterior densities
-
pymcmcstat.plotting.MCMCPlotting.
plot_histogram_panel
(chains, names=None, figsizeinches=None)[source]¶ Plot histogram from each parameter’s sampling history
pymcmcstat.plotting.PredictionIntervals module¶
Created on Wed Nov 8 12:00:11 2017
@author: prmiles
-
class
pymcmcstat.plotting.PredictionIntervals.
PredictionIntervals
[source]¶ Prediction/Credible interval methods.
- Attributes:
-
generate_prediction_intervals
(sstype=None, nsample=500, calc_pred_int=True, waitbar=False)[source]¶ Generate prediction/credible interval.
-
plot_prediction_intervals
(plot_pred_int=True, adddata=False, addlegend=True, figsizeinches=None, model_display={}, data_display={}, interval_display={})[source]¶ Plot prediction/credible intervals.
- Args:
- plot_pred_int (
bool
): Flag to include PI on plot. - adddata (
bool
): Flag to include data on plot. - addlegend (
bool
): Flag to include legend on plot. - figsizeinches (
list
): Specify figure size in inches [Width, Height]. - model_display (
dict
): Model display settings. - data_display (
dict
): Data display settings. - interval_display (
dict
): Interval display settings.
- plot_pred_int (
- Available display options (defaults in parantheses):
- model_display: linestyle (
'-'
), marker (''
), color ('r'
), linewidth (2
), markersize (5
), label (model
), alpha (1.0
) - data_display: linestyle (
''
), marker ('.'
), color ('b'
), linewidth (1
), markersize (5
), label (data
), alpha (1.0
) - data_display: linestyle (
':'
), linewidth (1
), alpha (1.0
), edgecolor ('k'
)
- model_display: linestyle (
-
setup_prediction_interval_calculation
(results, data, modelfunction, burnin=0)[source]¶ Setup calculation for prediction interval generation
- Args:
- results (
ResultsStructure
): MCMC results structure - data (
DataStructure
): MCMC data structure - modelfunction: Model function handle
- results (
pymcmcstat.plotting.utilities module¶
Created on Mon May 14 06:24:12 2018
@author: prmiles
-
pymcmcstat.plotting.utilities.
append_to_nrow_ncol_based_on_shape
(sh, nrow, ncol)[source]¶ Append to list based on shape of array
-
pymcmcstat.plotting.utilities.
check_settings
(default_settings, user_settings=None)[source]¶ Check user settings with default.
Recursively checks elements of user settings against the defaults and updates settings as it goes. If a user setting does not exist in the default, then the user setting is added to the settings. If the setting is defined in both the user and default settings, then the user setting overrides the default. Otherwise, the default settings persist.
-
pymcmcstat.plotting.utilities.
check_symmetric
(a, tol=1e-08)[source]¶ Check if array is symmetric by comparing with transpose.
-
pymcmcstat.plotting.utilities.
convert_flag_to_boolean
(flag)[source]¶ Convert flag to boolean for backwards compatibility.
-
pymcmcstat.plotting.utilities.
empirical_quantiles
(x, p=array([0.25, 0.5, 0.75]))[source]¶ Calculate empirical quantiles.
-
pymcmcstat.plotting.utilities.
extend_names_to_match_nparam
(names, nparam)[source]¶ Append names to list using default convention until length of names matches number of parameters.
For example, if names = [‘name_1’, ‘name_2’] and nparam = 4, then two additional names will be appended to the names list. E.g.,:
names = ['name_1', 'name_2', 'p_{2}', 'p_{3}']
-
pymcmcstat.plotting.utilities.
gaussian_density_function
(x, mu=0, sigma2=1)[source]¶ Standard normal/Gaussian density function.
-
pymcmcstat.plotting.utilities.
generate_default_names
(nparam)[source]¶ Generate generic parameter name set.
For example, if nparam = 4, then the generated names are:
names = ['p_{0}', 'p_{1}', 'p_{2}', 'p_{3}']
-
pymcmcstat.plotting.utilities.
generate_ellipse
(mu, cmat, ndp=100)[source]¶ Generates points for a probability contour ellipse
-
pymcmcstat.plotting.utilities.
generate_names
(nparam, names)[source]¶ Generate parameter name set.
For example, if nparam = 4, then the generated names are:
names = ['p_{0}', 'p_{1}', 'p_{2}', 'p_{3}']
-
pymcmcstat.plotting.utilities.
generate_subplot_grid
(nparam=2)[source]¶ Generate subplot grid.
For example, if nparam = 2, then the subplot will have 2 rows and 1 column.
-
pymcmcstat.plotting.utilities.
is_semi_pos_def_chol
(x)[source]¶ Check if matrix is semi positive definite by calculating Cholesky decomposition.
- Args:
- x (
ndarray
): Matrix to check
- x (
- Returns:
- If matrix is not semi positive definite return
False, None
- If matrix is semi positive definite return
True
and the Upper triangular form of the Cholesky decomposition matrix.
- If matrix is not semi positive definite return
-
pymcmcstat.plotting.utilities.
make_x_grid
(x, npts=100)[source]¶ Generate x grid based on extrema.
1. If len(x) > 200, then generates grid based on difference between the max and min values in the array.
2. Otherwise, the grid is defined with respect to the array mean plus or minus four standard deviations.
-
pymcmcstat.plotting.utilities.
set_local_parameters
(ii, local)[source]¶ Set local parameters based on tests.
Test 1: - local == 0
Test 2: - local == ii