Compute one-sided observed power for the ‘below’ (left) side.
Notes
Observed power is equivalent to the p-value evaluated under the
alternative hypothesis instead of the null-hypothesis. For example, if the
p-value is 0.05 and one is performing a test against an alpha of 0.05, the
observed power is 50% (i.e., if we would repeat the exact same experiment,
under the alternative hypothesis, there would be a 50% probability of
observing a p-value smaller than 0.05. Because, of the equivalence between
the p-value and observed power, it has very limited application.
Computes observed power for a given statistic, using the non-central
chi-square distribution.
Parameters:
statistic (float) – The chi-square statistic (e.g., sum of squares of standardised
residuals).
df (float) – Degrees of freedom for the chi-square distribution.
alpha (float, default 0.05) – The type I error rate.
Notes
Inherits from ObservedPower but overrides the distribution
to accommodate its strictly positive domain.
In a chi-square context, one generally considers whether the observed
statistic is ‘above’ a critical threshold. Hence, compute_power()
internally calls compute_power_above() rather than summing two tails.
Because chi-square is not defined below zero, compute_power_below()
is not meaningful and thus raises a NotImplementedError.
The procedure:
- First, compute the critical value (ppf) under the central chi-square
(nc=0).
Then, evaluate the cdf at x = self.crit under the non-central
chi-square with nc = self.statistic.
Subtract the density from 1 to calculate the observed power.
This approach can be easily verified using the normal distribution
>>> fromscipy.statsimportnorm>>> # use a test statistic of 4, and critical value of 1.96>>> ncnorm=norm(loc=4,scale=1.0)>>> 1-ncnorm.cdf(1.96)0.9793>>> norm.cdf(4-1.96)0.9793
Calculate the P-value based on the Z-statistic and the standard normal
distribution.
Parameters:
z_statistic (float) – Typically the ratio of the point estimate and the standard error,
representing the standardized difference from the value under the
null-hypothesis.
side ({two, left, right, ‘below’, ‘above’}, default two) – left will perform a left-sided, one-sided, z-test. right will
perform a right-sided, one-sided, z-test. below is a synonym for
left, and ‘above` is a synonym for right.
Calculate the P-value based on the t-statistic and the t distribution.
Parameters:
t_statistic (float) – Typically the ratio of the point estimate and the standard error,
representing the standardized difference from the value under the
null-hypothesis.
degrees (int) – The degrees of freedom.
side ({two, left, right, ‘below’, ‘above’}, default two) – left will perform a left-sided, one-sided, z-test. right will
perform a right-sided, one-sided, z-test. below is a synonym for
left, and ‘above` is a synonym for right.
Calculate the minor allele frequency (MAF) from genotype dosages.
Parameters:
genotypes (list [int | float]) – 1D array of genotype dosages coded as 0, 1, or 2, representing
the count of the effect allele per individual. Fractional values
in [0, 2] (e.g. imputed dosages) are accepted. Missing values
are not permitted and will raise an error.
Returns:
maf – The minor allele frequency, bounded in the interval [0, 0.5].
Return type:
float
Raises:
InputValidationError – If the input contains missing values, is empty, or contains
dosages outside the range [0, 2].
Notes
The allele frequency is computed as the mean dosage divided by two.
The MAF is then defined as min(p,1-p), where p is the
frequency of the effect allele.
Interval estimation tools for confidence and prediction intervals.
This module provides functions to compute interval estimates from empirical
data, including exact and approximate confidence intervals and prediction
intervals. It supports methods based on the normal approximation,
binomial distribution, beta distribution, and quantile-based approaches.
Compute beta confidence intervals for proportions, based on a classic
contribution by SA Julious [1]_.
Parameters:
proportion (float) – A proportion between 0 and 1.
total_sample (int) – The total sample size from which the proportion was derived.
alpha (float, default 0.05) – The 100(1-alpha)% confidence level.
integer (bool, default True) – Whether the function should raise an error if the product of
proportion * total_sample is not an integer. If set to False,
the function will issue a warning and round the product to the
nearest integer.
Returns:
A results class returning the lower and upper confidence interval
bounds.
Compute exact variance propagation for linear contrasts of regression
coefficients.
For any linear contrast L = D’ * beta, the variance is:
Var(L) = D’ * V * D
This is exact and holds for any regression model with a
coefficient vector and variance-covariance matrix.
Parameters:
d_mat (array_like, shape (n_coef, n_contrasts)) – Contrast matrix. Each column defines one contrast, each
row corresponds to one coefficient. Set a row to zero to
exclude that coefficient from the contrast.
v_mat (array_like, shape (n_coef, n_coef)) – Variance-covariance matrix of the coefficients.
c_vec (array_like, shape (n_coef,)) – Point estimates of the model coefficients.
contrast_names (list [str], default None) – Labels for each contrast. Defaults to
[“contrast_1”, “contrast_2”, …].
alpha (float, default 0.05) – The 100(1-alpha)% confidence level.
Returns:
One row per contrast with columns: contrast, estimate,
se, lower, upper. All values are on the linear predictor
scale; any back-transformation is the caller’s
responsibility.
Return type:
pd.DataFrame
Raises:
ValueError – If dimensions of d_mat, v_mat, c_vec are inconsistent,
alpha is outside (0, 1), or contrast_names length
does not match ncol(d_mat).
Notes
Generality across model types
Works for OLS, GLM, Cox, mixed-effects, penalised regression,
or any model yielding a coefficient vector and covariance
matrix. For spline or polynomial terms, populate the
corresponding rows of d_mat with the evaluated basis values
at the target point (e.g. from a fitted spline object).
Link scale
For models with a nonlinear link (logistic, Poisson, Cox),
estimates are returned on the link scale. Back-transform and
propagate uncertainty externally as needed.
Interactions and piecewise equations
Include the product (or indicator) terms explicitly in d_mat.
For example, for treatment effect in females under a
treatment * gender interaction, set both the treatment row
and the interaction row to 1.
Examples
Linear model: y ~ gender * treatment
Coefficients: intercept, gender_female, treatment,
treatment:gender_female
Treatment effect in males: [0, 0, 1, 0]
Treatment effect in females: [0, 0, 1, 1]
Compute an exact confidence interval for a univariate quantile.
Estimates the lower and upper bounds of a 100(1 - alpha)% confidence
interval around a specified quantile of the input data. The function
returns both the values and indices of the bounds, as well as the
exact coverage probability.
Parameters:
values (list [float]) – A list of floats representing the available data.
quantile (float) – The target quantile (between 0 and 1); for example,
0.5 for the median, 0.25 for the first quartile, or 0.025
for the 2.5th percentile.
alpha (float, default 0.05) – The 100(1-alpha)% confidence level.
window (int, default 2) – The number of points allowed around the exact quantile
index when searching for valid intervals.
Returns:
An object containing the interval indices, interval bounds, the
point estimate, and the exact coverage probability.
This method uses the binomial distribution to derive the exact probability
of a value being less than or equal to the desired quantile. It does not
make assumptions about the underlying distribution of the data and thus
produces nonparametric, exact confidence intervals. The returned interval
is guaranteed to have coverage greater than or equal to the nominal level.
The code is based on the
stackexchange answer by whuber.
Which in turn is based on Chapter 5 of Meeker, Hahn, and Escobar’s
book [1]_.
Statistical tests for null-hypothesis significance testing.
This module provides a set of tools for conducting null-hypothesis
significance tests, including classical approaches such as the
Kolmogorov–Smirnov test, Wald tests, and one-way ANOVA. These methods
operate on either raw or summarised data, and return structured
results encapsulated in specialised results classes.
Computes the F-statistic and corresponding p-value for a one-way
analysis of variance, given group-level means, variances, and sample sizes.
Parameters
varianceslist [int | `float]
Sample variances for each group.
sizeslist [int]
Sample sizes of each group.
Returns:
A results object containing the F-statistic, p-value, sum of
squares (explained and residual), and degrees of freedom.
This implementation is suitable when only group-level summary
statistics are available, in contrast to the standard ANOVA
method which requires individual-level observations.
Perform the Kolmogorov–Smirnov test across grouped data.
Applies a one-sample Kolmogorov–Smirnov test to subgroups within a
DataFrame, assessing whether each group’s distribution differs from a
specified null distribution.
Parameters:
data (pd.DataFrame) – A table containing column names group and values refer to.
group (str) – Column name in data used to define group membership.
values (str) – Column name in data containing the values to be tested.
nulldistribution (str, default uniform) – The reference distribution for the KS test. Must be a valid name
from scipy.stats.
Returns:
A dictionary mapping each group label to the corresponding KS test
result object.
Meta-analysis estimators for weighted averages and heterogeneity assessment.
This module provides methods for calculating weighted averages of point
estimates using fixed-effect and random-effects models. It includes
implementations of standard estimators for between-study variance
(tau-squared), Q-tests for heterogeneity, and I-squared statistics.
Iterative and non-iterative estimators are supported, including
DerSimonian-Laird, Cochrane ANOVA, Paule-Mandel, and method of moments.
Provides heterogeneity estimates (Q-test, I-squared, and Tau-square) [2]_,
determining too what extent the individual estimates are distinct from
the overall_estimate, accounting for difference in precision based on
the supplied estimate specific standard_errors.
Parameters:
estimates (list [float]) – A list of point estimates (e.g., mean differences or log odds ratios).
standard_errors (list [float]) – Corresponding standard errors for each estimate.
overall_estimate (float or int) – The overall estimate, for example based on a meta-analysis of the
point estimates.
alpha (float, default 0.05) – The alpha for the (1-alpha/2)*100% confidence interval.
tau2 (float, optional) – A possible external estimate of the tausquard used in the random effects
estimator. If NoneType a non-iterative MM estimate will be used.
Heterogeneity will be internally evaluated using a Chi-square distribution
with len(estimates) - 1 degrees of freedom.
The heterogeneity estimates are based on [2]_, specifically the tau-squared
is estimated using the DerSimonian and Laird method of moments method
(without iteration).
estimates (list [float]) – A list of point estimates (e.g., mean differences or log odds ratios).
standard_errors (list [float]) – Corresponding standard errors for each estimate.
between_estimate_variance (float) – The between estimate variance, often referred to as the tau-squared.
Can be estimated using the Heterogeneity function.
Returns:
estimate (float) – The average estimate,
standard_error (float) – The standard error of the average estimate.
Notes
Setting between_estimate_variance to zero will results in a fixed effect
estimate.
A module implementing Firth’s logistic regression.
Firth’s regression is a penalised likelihood method that addresses small-sample
bias and perfect separation in logistic regression. It adjusts score function
to yield more reliable parameter estimates.
Note this is essentially a fork of the GitHub firthlogist
repo, with minor tweaks to work on python 3.10+.
Logistic regression with Firth’s bias reduction method.
This is based on the implementation in the logistf R package. Please see
the logistf references [1]_ and [2]_ for details about the method.
Parameters:
max_iter (int, default 25) – The maximum number of Newton-Raphson iterations.
max_halfstep (int, default 0) – The maximum number of step-halvings in one Newton-Raphson iteration.
max_stepsize (int, default 5) – The maximum step size - for each coefficient, the step size is forced
to be less than max_stepsize.
pl_max_iter (int, default 100) – The maximum number of Newton-Raphson iterations for finding profile
likelihood confidence intervals.
pl_max_halfstep (int, default 0) – The maximum number of step-halvings in one iteration for finding profile
likelihood confidence intervals.
pl_max_stepsize (int, default 5) – The maximum step size while finding PL confidence intervals.
tol (float, default 0.0001) – Convergence tolerance for stopping.
fit_intercept (bool, default True) – Specifies if intercept should be added.
skip_pvals (bool, default False) – If True, p-values will not be calculated. Calculating the p-values can
be time-consuming if wald=False since the fitting procedure is
repeated for each coefficient.
skip_ci (bool, default False) – If True, confidence intervals will not be calculated. Calculating the
confidence intervals via profile likelihoood is time-consuming.
wald (bool, default False) – If True, uses Wald method to calculate p-values and confidence
intervals.
test_vars (int, list [int], or None, default None) – Index or list of indices of the variables for which to calculate
confidence intervals and p-values. If None, calculate for all variables.
This option has no effect if wald=True.
Configure whether metadata should be requested to be passed to the score method.
Note that this method is only relevant when this estimator is used as a
sub-estimator within a meta-estimator and metadata routing is enabled
with enable_metadata_routing=True (see sklearn.set_config()).
Please check the User Guide on how the routing
mechanism works.
The options for each parameter are:
True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.
False: metadata is not requested and the meta-estimator will not pass it to score.
None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.
str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (sklearn.utils.metadata_routing.UNCHANGED) retains the
existing request. This allows you to change the request for some
parameters and not others.
Added in version 1.3.
Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for sample_weight parameter in score.
Prints and extracts cross-validation results from a sklearn based
hyper-parameter search. Copied from here.
Parameters:
results (dict) – A dictionary with grid search results, e.g., from a
sklearn.model_selection._search.GridSearchCV.cv_results_ object.
The dictionary should contain the keys rank_test_score,
mean_test_score, std_test_score, and params.
n_top (int, default 3) – The top n results that should be printed - based on the
rank_test_score column of results, so it automatically adjusts for
the criterion (scores) that are looking for a minimum, or maximum.
Will be ignored if verbose is False.
sort (str or None, default None) – Set to ascending or descending, which will internally be parsed as a
boolean argument to ascending in pandas.DataFrame.sort_values.
verbose (bool, default True) – If something should be printed.
Returns:
A ranked table with information on the used hyper-parameters, the run
time and the performance. For the exact meaning please refer to the
documentation of the supplied results object.
Will take a supervised learning algorithm learner and tune the
algorithm’s hyper-parameters using a searcher.
Common sklearn searching algorithms include:
GridSearchCV, to perform an exhaustive search,
RandomizedSearchCV, which samples candidate parameters from supplied
statistical distributions.
Have a look at the sklearn documentation for further options and discussion.
When strata is supplied, the searcher will be applied to each
individual stratum value. Per hyper-parameter set the perofrmance metric
will be averged, and internally the best set (with rank 1) will be selected
and returned as a searcher object with a single (best) model.
Parameters:
learner (callable) – An sklearning supervised algorithm, such as NuSVC or
RandomForestClassifier.
searcher (callable) – A searching algorithm to tune the hyper-parameters of learner
X (np.ndarray) – The design matrix containing all the features as columns and the
observations/subjects as rows.
Y (np.ndarray) – A matrix with the dependent variable(s), i.e., the labelled data.
fixed_learner_dict (dict or None, default None) – Optional keyword arguments for the learner, specifying parameters
which do not need to be tuned.
searcher_params_dict (dict or None, default None) – Optional keyword arguments for the searcher algorithm.
fit_dict (dict or None, default None) – Optional keyword arguments for the searcher.fit callable.
strata (np.ndarray or None, default None) – An optional r by 1 matrix with discrete values to stratify the tuning
algorithm on. Will perform separate tuning on each stratum and
return the hyper-parameter set with the average (mean) optimised
performance for the learner. Will be ignored if set to None.
strata_ascending (bool, default False) – Wether the largest or smallest optimisation metric should be used to
identify the best model. For example, for c-statistic one would want
the largest value, whereas for the mean squared error one would
prefer the hyper-parameters with the smallest value.
Returns:
pd.DataFrame – A table of search results.
SklearnClass – The searcher object with either a single best model (when strata is
supplied), or alternatively all the models evaluated by the searcher.
A collection of utils for scikit-survival. Currently, the module focussed on
downstream extracton of predictions and outcomes, as well as on tools to help
with model validation.
The code can likely be generalised further to work with non-sksurv models as
well.
Evaluates a sklearn-survival model using the integrated Brier score,
and computes the baseline (non-informative) Brier score based on the event
incidence in supplied test data.
Parameters:
model (Callable) – A fitted sklearn-survival model that implements a
predict_survival_function method returning survival functions for
individuals.
times (np.ndarray) – A sequence of time points over which the integrated Brier score is
computed.
Creates groups based on the predicted survival and compared the predicted
event rate to the non-parametric event rate.
Parameters:
model (Callable) – A fitted scikit-survival model with a predict_survival_function
method.
n_groups (int, default 5) – Number of equally sized participant groups, created based on the
predicted survival.
nonparametric_estimator (Callable, default KaplanMeierEstimator) – A nonparametric estimator class from sksurv.nonparametric, e.g.
KaplanMeierEstimator or CumulativeIncidenceEstimator.
Computes time-dependent AUCs for survival models using cumulative
dynamic AUC.
Parameters:
model (callable or NoneType) – A fitted survival model with a predict(X) method. If None,
assumes d_tup[1] already contains predicted risk scores.
times (list [float]) – Time points at which to evaluate the time-dependent AUC.
data (tuple [str, np.ndarray, np.ndarray]) – The tuple should contain (label, test_y, test_x or predicted_risk),
where test_y is a structured array of survival data
(e.g., from sksurv.util.Surv.from_arrays), and label is a
descriptor of the data split (e.g., ‘test’, ‘validation’).
train_y (np.ndarray) – Structured array of survival outcomes for training data, used to
construct the risk sets.
Returns:
A long-format DataFrame with columns:
- “Data split”: label of the data subset
- “Time”: time points evaluated
- “AUC by time”: corresponding AUC values
- “Mean AUC”: mean of AUCs across time points (NaNs ignored)
Return type:
pd.DataFrame
Notes
This function evaluates the performance of a survival model across
multiple time points using the cumulative/dynamic AUC approach
(as implemented in cumulative_dynamic_auc from sksurv.metrics).
It handles multiple data splits or datasets and aggregates the results
into a tidy DataFrame.
Tools to evaluate prediction models at a fixed time-point.
This module provides functions to assess the performance of binary classifiers,
with a focus on both discrimination (e.g. c-statistics) and calibration
(e.g. calibration slope and intercept). Recalibration tools for risk prediction
and agreement metrics for continuous outcomes are also included.
The vertical translation constant ((μ_X - μ_Y) / sqrt(σ_X σ_Y)).
Type:
float
Notes
The CCC is defined as:
CCC = 2ρ σ_X σ_Y / (σ_X² + σ_Y² + (μ_X - μ_Y)²)
where ρ is the Pearson correlation, σ_X and σ_Y are the standard deviations
of x and y, and μ_X, μ_Y their respective means.
The CCC combines measures of precision and accuracy to assess agreement
between paired measurements. It is often used in method comparison studies,
biometrics, and reliability analysis.
It penalises for both lack of correlation and systematic bias (e.g. shifts
in location or scale), in contrast to the Pearson correlation which captures
only linear association.
The CCC is conceptually related to the Intraclass Correlation Coefficient
(ICC). Both are measures of agreement, but the CCC is specifically
designed for paired continuous data and includes a built-in bias penalty.
The ICC is more general and often used in the context of multiple raters or
repeated measurements under different conditions.
Compute Harrell’s concordance statistic (c-statistic) for a model
predicting a binary outcome.
Parameters:
observed (pd.Series or np.ndarray) – a column vector with the observed class.
predicted (pd.Series or np.ndarray) – a column vector with the predicted class or log/predicted probability.
alpha (float or None, default None) – the (1-alpha)% confidence interval. Default None for no confidence
interval.
Returns:
Harrel’s c-statistics with optional confidence interval.
Return type:
CstatisticResults
Notes
This function estimates the probability that, for a randomly chosen pair
of individuals (one with and one without the event), the predicted score is
higher for the individual with the event. Optionally, a confidence interval
can be calculated based on an asymptotic approximation.
Predictions (predicted column) can range between +- infinity, allowing for
evaluations of non-Prob scores.
The standard error are derived based on _[1] Hanley and McNeil.
Compute the ROC curve and return it as a tidy DataFrame.
Parameters:
observed (np.ndarray) – A column vector of the observed binary outcomes.
predicted (np.ndarray) – A column vector of the predicted outcome, e.g., representing the
predicted probability.
**kwargs (Any) – Additional keyword arguments passed to sklearn.metrics.roc_curve.
Returns:
A table with the following columns:
- false_positive: False positive rate at each threshold.
- sensitivity: True positive rate (sensitivity).
- threshold: Score thresholds used to compute the curve.
Return type:
pd.DataFrame
Notes
This function wraps sklearn.metrics.roc_curve and converts the result into
a structured DataFrame for convenient plotting or inspection
Estimate the calibration slope and calibration-in-the-large assuming a
binomial data generating model. A binomial model is generally appropriate
if the predicted risk reflects an event occurring at a fixed moment in time,
e.g. after 1 year or 1 hour.
Parameters:
data (pd.DataFrames) – A table with the columns observed and predicted.
observed (str) – a column name in data referencing the binary outcome column.
predicted (str) – a column name in data referencing the logit predicted risk.
bins (int, optional, default NoneType) – an optional integer used to create equally sized bins of the predicted
logit risk and returns the average predicted and observed risk in
each bin (an observed vs expected table)
alpha (float, default 0.05) – the (1-alpha)% confidence interval. Used for the observed risk when
bin is supplied.
kwargs_ci (dict [str, any] or None, default None.) – Any keyword arguments for beta_confidence_interval. For example,
to supply integer = False.
Returns:
A calibration intercept and slope estimates, and an optional
observed and expected table.
The model assumes the predicted value is on the log-odds scale (logit).
If your model outputs probabilities, use the logit transform beforehand.
The calibration intercept is computed using a GLM with an offset, and the
slope via standard logistic regression.
The grouped calibration table is based on quantile binning of predicted
risks.
The function DOES not presuppose the predicted risk is derived from a
logistic (binomial) regression model. ANY model predicting risk at a fixed
moment in time is acceptable, including models that typically provide
discrete predictions such a classification trees. Some/many models or rules
may only provide predicted risk not the logit risk, in such cases simply
call the logit function to derive the appropriate variable.
The original score will be re-trained on observed outcome data, improving
the agreement between the observed and predicted risk/outcome.
Parameters:
data (pd.DataFrame) – A table with columns score and observed.
observed (str) – a column name in data
score (str) – a column name in data. Note that contrary to the calibration function
the score can be in any format depending on intended use. For binomial
model one would typically want to supply a logit risk.
model (str, default binomial) – which model should be used (default: ‘binomial’, or ‘gaussian’)
Returns:
The recalibration intercept and slope, as well as a table with the
recalibrated predictions.
This module provides tools for non-parametric resampling procedures, including
bootstrap and jackknife methods. It implements several widely used approaches
for confidence interval estimation, such as percentile intervals, basic
bootstrap, bias-corrected and accelerated (BCa), and studentised intervals.
These methods operate on raw data supplied as tuples of NumPy arrays, and are
designed to work with user-defined statistical functions. Results are returned
as structured objects that encapsulate interval estimates, coverage
probabilities, and resampling metadata.
Computes jackknife replicates by systematically omitting each observation.
Notes
All core resampling functions have been optimised using Numba for performance.
Input arrays must have consistent row dimensions. Output is typically returned
as NumPy arrays or results class instances that support structured inspection
and downstream usage.
Jackknife estimates of statsfunction. None until __call__ is invoked.
Type:
np.ndarray or None
Notes
The BCa interval generally has a better coverage (i.e. the smallest
confidence interval while retaining advertised coverage) than most
alternative boostrap confidence interval methods.
Compute the statistic(s) on the original (non-resampled) data.
Notes
This class handles the generation of bootstrap replicates and calculation
of original estimates from the provided dataset using a specified
statistical function.
Draws n_reps bootstrap samples and applies statsfunction on each bth
sample, return the results as an numpy array.
Parameters:
data (tuple [np.ndarray]) – A tuple of numpy arrays with the same number of rows.
statsfunction (Callable) – A function which can unpack a tuple of arrays and perform analyses on
these: statsfunction(*data). The function can return the estimate(s)
as a single float/int, list, tuple or numpy array.
n_estimates (int) – The number of estimates statsfunction will return.
n_reps (int, default 999) – The number of bootstrap samples.
**kwargs (any) – Any keyword arguments supplied to statsfunctions.
Returns:
A 2d numpy array with dims equal to n_reps by n_estimates.
Return type:
np.ndarray
Notes
The helper functions have been optimised through numba.njit.
Will internally map 1d arrays to 2d to deal with numba requirements.
Examples
>>> importnumpyasnp>>> np.random.seed(42)>>>>>> # Example statsfunction that returns a list of statistics>>> defstats_list(*data):... return[np.mean(data[0]),np.std(data[0])]>>>>>> result=bootstrap_replicates(... (np.random.randn(10),np.random.randn(10)),... stats_list,n_estimates=2,n_reps=10... )>>> print(result)
Performs jackknife resampling procedure which systematically leaves out
one observation at a time and applies statsfunction.
Parameters:
data (tuple [np.ndarray]) – A tuple of numpy arrays with the same number of rows.
statsfunction (Callable) – A function which can unpack a tuple of arrays and perform analyses on
these: statsfunction(*data). The function can return the estimate(s)
as a single float/int, list, tuple or numpy array.
n_estimates (int) – The number of estimates statsfunction will return.
**kwargs (any) – Any keyword arguments supplied to statsfunctions.
Returns:
A 2d numpy array with dims equal to data[0].shape[0] by n_estimates.
Return type:
np.ndarray
Notes
The helper functions have been optimised through numba.njit.
Will internally map 1d arrays to 2d to deal with numba requirements.