Statistical Analysis and Regression Library
Project description
SARLIB: Statistical Analysis and Regression Library
sarlib - Statistical Analysis and Regression Library
This library provides tools for statistical analysis, regression modeling, sample size analysis, and visualization. It includes OLS and SAR models, as well as utilities for data preprocessing and plotting.
Installation
sarlib is a standalone Python module. To use it, ensure you have the following dependencies installed:
- numpy
- matplotlib
- statsmodels
- scikit-learn
- scipy
You can install these with pip:
pip install numpy matplotlib statsmodels scikit-learn scipy
Usage
Import the module in your Python script:
import sarlib
Or copy the code into your project and import the classes/functions as needed.
Main Components
-
fix_data(x, y): Standardizes and cleans input data.
-
show_scatter(x, y, ...): Visualizes predictors vs. response.
-
OLS: Ordinary Least Squares regression with permutation-based significance and power analysis.
-
SAR: Statistical Analysis Regression with PAC-Bayes, Vapnik, and IGP bounds.
-
SampleSizeAnalysis: Analyzes the effect of sample size on model performance and statistics.
Example Workflow
-
Prepare your data as numpy arrays:
import numpy as np x = np.random.randn(100, 3) # predictors y = np.random.randn(100) # response
-
Visualize data:
show_scatter(x, y)
-
Fit OLS model:
model_ols = OLS(n_realiz=100, alpha=0.05) stats_ols = model_ols.fit(x, y, verbose=True)
-
Fit SAR model:
model_sar = SAR(n_realiz=100, norm='epsins', alpha=0.05) stats_sar = model_sar.fit(x, y, verbose=True)
-
Analyze sample size effect:
analysis = SampleSizeAnalysis(model_sar, x, y, steps=7) analysis.plot_loss() analysis.plot_pvalue() analysis.plot_coef()
Function/Class Documentation
All functions and classes are documented with docstrings. Please refer to the code for parameter details and usage.
License & Author
Author: Sipba Group, UGR, https://sipba.ugr.es/ License: GPL Version 3
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sarlib-0.0.2.tar.gz.
File metadata
- Download URL: sarlib-0.0.2.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac9620fae1c148e96c079f9c1caa3aaaa232a9c84d0935cb9e532dc8f00835ab
|
|
| MD5 |
15a1f402905b2b3cfec0bcf2c2387a83
|
|
| BLAKE2b-256 |
f22480e8aa2b1b4e2477e6652d0f85eb24b32d6ed734fc80ddb92ad05f7c03fe
|
File details
Details for the file sarlib-0.0.2-py3-none-any.whl.
File metadata
- Download URL: sarlib-0.0.2-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e4b6347ccc9cf373d326335b2ad30e40f6e4ea81b1093463052f00b5720226c
|
|
| MD5 |
50fc5de4166a705490be6930d2df45c7
|
|
| BLAKE2b-256 |
fbf1f0284dc467403c3a7d0f6b0e065b7267049d9c7e811879818260971466ac
|