strapvizpy.display
Module Contents
Functions
|
Makes a histogram of a boostrapped sampling distribution |
|
Makes two tables that summerize the statistics from the bootstrapped |
- strapvizpy.display.plot_ci(sample, rep, bin_size=30, n='auto', ci_level=0.95, ci_random_seed=None, title='', x_axis='Bootstrap Sample Mean', y_axis='Count', path=None)[source]
Makes a histogram of a boostrapped sampling distribution with its confidence interval and oberserved mean.
- Parameters
sample (list or numpy.ndarray or pandas.core.series.Series) – sample to bootstrap
rep (int) – number of replicates of the distribution
int (bin_size =) – a number of bins representing intervals of equal size over the range
n (str or int, default="auto") – bootstrap sample size, “auto” specifies using the same size as the sample
ci_level (float, default=0.95) – confidence level
ci_random_seed (None or int, default=None) – seed for random state
title (str, default = "") – title of the histogram
x_axis (str, default = "Bootstrap Sample Mean") – name of the x axis
y_axis (str, default = "Count") – name of the y axis
path (None or str, default = None) – specify the directory to save the figure as .png
- Returns
plot – histogram of bootstrap distribution with confidence interval and oberserved mean
- Return type
histogram
Examples
>>> plot_ci([1, 2, 3, 4, 5, 6, 7], 1000, n=100, ci_level=0.95, ci_random_seed=123, title="Bootstrap")
- strapvizpy.display.tabulate_stats(stat, precision=2, estimator=True, alpha=True, path=None)[source]
Makes two tables that summerize the statistics from the bootstrapped samples and the parameters for creating the bootstrapped samples. It also allows you to save the tables in html format.
- Parameters
stat (dict or tuple) – summary statistics produced by the calculate_boot_stats() function
precision (int, default=2) – the precision of the table values
estimator (boolean, default=True) – include the bootstrap estimate in the summary statistics table
alpha (boolean, default=True) – include the significance level in the summary statistics table
path (str, default = None) – specify a path to where the tex files of tables should be saved.
- Returns
- summary statistics: style object
table summerizing the lower bound and upper bound of the confidence interval,the standard error, the sampling statitic (if estimator = True), and the significance level (if alpha = True). Style objects do not display well in a python shell.
- bootstrap parameters: style object
table summerizing the parameters of the bootstrap sampling spficiying the original sample size, number of repititions, the significance level, and the number of samples in each bootstrap if its different from the original sample size. Style objects do not display well in a python shell.
- Return type
tuple
Examples
>>> st = calculate_boot_stats([1, 2, 3, 4], 1000, level=0.95, random_seed=123) >>> stats_table, parameter_table = tabulate_stats(st) >>> stats_table >>> parameter_table