API Reference

Visualization

confints

Make a horizontal plot of centers/conf ints with error bars.

fill_between

Create a filled region between two curves.

qqplot

Generate a Q-Q plot.

contour

Make a contour plot, possibly overlaid on an image.

predictive_ecdf

Plot a predictive ECDF from samples.

predictive_regression

Plot a predictive regression plot from samples.

sbc_rank_ecdf

Make a rank ECDF plot from simulation-based calibration.

parcoord

Make a parallel coordinate plot of MCMC samples.

trace

Make a trace plot of MCMC samples.

corner

Make a corner plot of sampling results.

contour_lines_from_samples

Get lines for a contour plot from (x, y) samples.

cdf_to_staircase

Convert discrete values of CDF to staircase for plotting.

q_to_color

Convert a quantitative value to a color.

mpl_cmap_to_color_mapper

Convert a Matplotlib colormap to a bokeh.models.LinearColorMapper instance.

to_ColumnDataSource

Bootstrap methods

seed_rng

Seed random number generators for Numpy and Numba'd functions.

draw_bs_reps

Generate bootstrap replicates out of data using func.

draw_bs_reps_pairs

Perform pairs bootstrap for single statistic.

draw_bs_reps_mle

Draw bootstrap replicates of maximum likelihood estimator.

draw_perm_reps

Generate permutation replicates of func from data_1 and data_2

diff_of_means

Difference in means of two arrays.

studentized_diff_of_means

Studentized difference in means of two arrays.

pearson_r

Compute the Pearson correlation coefficient between two samples.

Hamiltonian Monte Carlo utilities

install_cmdstan_colab

Install CmdStan with Google Colab.

include_path

Return path to include files for Stan.

clean_cmdstan

Remove all .hpp, .o, .d, and executable files resulting from compilation of Stan models using CmdStanPy.

cmdstan_version

Determine CmdStan version

df_to_datadict_hier

Convert a tidy data frame to a data dictionary for a hierarchical Stan model.

convert_samples

Converts samples to a new format.

extract_variable

Extracts sample of a variable as a Numpy array.

check_hmc_diagnostics

Check to all HMC diagnostics that are included in Stan's output (divergences, EFMI, tree depth, acceptance rate).

check_expectand_diagnostics

Check all expectand-specific diagnostics for a collection of Markov chains (tail xi_hats, empirical variance, split Rhat, incremental integrated autocorrelation time, and effective sample size).

check_all_diagnostics

Check all MCMC diagnostics, both HMC and expectand diagnostics.

tau_hat

Compute the empirical integrated autocorrelation time for each expectand for each chain.

tail_xi_hat

Compute the empirical generalized Pareto shape (xi_hat) for the upper and lower tails of a sample of expectand values, ignoring any autocorrelation between the values.

ess_hat

Compute the empirical effective sample size for all expectand output ensembles across a collection of Markov chains.

split_rhat

Compute split Rhat for all expectand output ensembles across a collection of Markov chains.

check_variance

Compute the variance of each variable for each chain and report True if the variance if nonzero and False if the variance is zero.

decode_warning_code

Parse a binary diagnostic warning code from check_all_diagnostics() into individual failures and print the results.

inferential_calibration

Perform simulation-based calibration on a Stan Model.

disable_logging

Context manager for disabling logging when doing MCMC sampling.

Gaussian process utilities

append_sort_index

Add the entries of X to Xstar, sort the result, and find indices in the results where the entries in X appear.

linear_kernel

Linear kernel.

polynomial_kernel

Polynomial kernel: (sigma_0^2 + sigma_p^2 x1 .

se_kernel

Squared exponential kernel.

exp_quad_kernel

Exponentiated quadratic (a.k.a.

matern_kernel

Matern kernel.

periodic_kernel

Periodic kernel.

d1_se_kernel

Derivative of first variable of squared exponential kernel.

d1_exp_quad_kernel

Derivative of first variable of the exponentiated quadratic (a.k.a.

d2_se_kernel

Derivative of second variable of squared exponential kernel.

d2_exp_quad_kernel

Derivative of the exponentiated quadratic (a.k.a.

d1_d2_se_kernel

Mixed second derivative of squared exponential kernel.

d1_d2_exp_quad_kernel

Mixed second derivative of exponentiated quadratic (a.k.a.

d1_matern_kernel

Derivative of the Matern kernel with respect to the first variable.

d2_matern_kernel

Derivative of the Matern kernel with respect to the second parameter.

d1_d2_matern_kernel

Mixed second derivative of Matern kernel.

cov_exp_quad

Return covariance matrix for exponentiated quadratic (a.k.a.

cov_se

Return covariance matrix for squared exponential kernel.

cov_d1_exp_quad

Return covariance matrix for exponentiated quadratic (a.k.a.

cov_d1_se

Return covariance matrix for squared exponential kernel differentiated by the first variable.

cov_d1_d2_exp_quad

Return covariance matrix for exponentiated quadratic (a.k.a.

cov_d1_d2_se

Return covariance matrix for squared exponential kernel differentiated once by the first variable and once by the second.

cov_matern

Return covariance matrix for a Matérn kernel.

cov_d1_matern

Return covariance matrix for Matérn kernel differentiated by the first variable.

cov_d1_d2_matern

Return covariance matrix for Matérn kernel differentiated once by the first variable and once by the second.

cov_periodic

Return covariance matrix for a perdioic kernel.

cov_from_kernel

Return covariance matrix for specified kernel.

posterior_mean_cov

Compute the posterior mean vector and covariance matrix for a posterior Gaussian process derived from a Normal likelihood and Gaussian process prior.

posterior_mean_cov_deriv

Compute the posterior mean vector and covariance matrix for the derivative of a posterior Gaussian process derived from a Normal likelihood and Gaussian process prior.

HoloViews defaults

set_defaults

Set convenient HoloViews defaults.

no_xgrid_hook

Hook for disabling x-grid lines.

no_ygrid_hook

Hook for disabling x-grid lines.

Image processing utilities

imshow

Display an image in a Bokeh figure.

record_clicks

Display and record mouse clicks on a Bokeh plot of an image.

draw_rois

Draw and record polygonal regions of interest on a plot of a Bokeh image.

roicds_to_df

Convert a ColumnDataSource outputted by draw_rois() to a Pandas DataFrame.

im_merge

Merge channels to make RGB image.

rgb_to_rgba32

Convert an RGB image to a 32 bit-encoded RGBA image.

rgb_frac_to_hex

Convert fractional RGB values to hexidecimal color string.

simple_image_collection

Load a collection of images.

verts_to_roi

Converts list of vertices to an ROI and ROI bounding box

costes_coloc

Perform Costes colocalization analysis on a pair of images.

General utilities

unpivot_csv

Converts a CSV file in wide format, possibly with a hierarchical column, index to tall format via a unpivot operation.