StatsLibX logoStatsLibX

ComputationalStats

v0.3.0

Computational statistical methods including regression, interpolation, bootstrapping, and clustering algorithms for advanced data analysis.

Class Overview

The ComputationalStats class provides advanced computational statistics methods for regression analysis, interpolation, bootstrapping, and clustering. It is designed for users who need to perform sophisticated statistical computations on their data.

from statslibx import ComputationalStats

cs = ComputationalStats(data)

Methods

regression
regression(X, y, degree=1, interaction_terms=False)
linear_regression
linear_regression(X, y)
polynomial_regression
polynomial_regression(X, y, degree=2)
find_best_degree
find_best_degree(X, y, max_degree=5, metric='r2')
interpolation
interpolation(points, method='lagrange', spline_degree=3)
bootstrapping
bootstrapping(column, n_samples=1000, statistic='mean', confidence_level=0.95, custom_func=None)
k_means
k_means(k, max_iters=100, init_method='kmeans++')
elbow_method
elbow_method(max_k=10)
correlation_analysis
correlation_analysis(method='pearson')
plot_correlation_heatmap
plot_correlation_heatmap(method='pearson', annot=True, interactive=False)
descriptive_statistics
descriptive_statistics(by=None)
plot_distribution
plot_distribution(column, by=None, kind='hist', interactive=False)

Result Classes

RegressionResult

Returned by regression(), linear_regression(), and polynomial_regression(). Provides comprehensive regression diagnostics and utilities.

Properties

  • coefficients — Model coefficients
  • r2 — R-squared value
  • r2_adj — Adjusted R-squared
  • mse — Mean squared error
  • rmse — Root mean squared error
  • aic — Akaike information criterion
  • bic — Bayesian information criterion
  • residuals — Residual values

Methods

  • predict() — Predict on new data
  • summary() — Print detailed summary
  • plot() — Visualize regression results
  • get_formula() — Return equation string

InterpolationResult

Returned by interpolation(). Encapsulates the fitted interpolation function and provides evaluation utilities.

Properties

  • points — Original interpolation points
  • method — Interpolation method used
  • coefficients — Polynomial/spline coefficients

Methods

  • predict() — Evaluate at new x values
  • summary() — Print interpolation summary
  • plot() — Visualize the interpolation curve

BootstrappingResult

Returned by bootstrapping(). Contains the bootstrap distribution, bias, standard error, and multiple confidence interval estimates.

Properties

  • original_statistic — Statistic on original data
  • bias — Bootstrap bias estimate
  • std_error — Bootstrap standard error
  • percentile_ci — Percentile confidence interval
  • basic_ci — Basic bootstrap CI
  • normal_ci — Normal approximation CI

Methods

  • summary() — Print bootstrap summary
  • plot() — Visualize bootstrap distribution