Statistical Analysis and Regression Library
Project description
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 can be installed via PyPI:
pip install sarlib
Alternatively, you can install it manually by downloading the source code. In that case, make sure you have the following dependencies installed:
- numpy
- matplotlib
- statsmodels
- scikit-learn
- scipy
- pyside (only for GUI)
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
-
Import packages and prepare your data as numpy arrays:
from sarlib import SAR, OLS, SampleSizeAnalysis, show_scatter import numpy as np x = np.random.randn(100, 3) # predictors y = np.random.randn(100) # response
-
Visualize data:
show_scatter(x, y)
-
Fit SAR model:
model_sar = SAR(n_realiz=100, norm='epsins', alpha=0.05) stats_sar = model_sar.fit(x, y, verbose=True)
-
Compare with an OLS model:
model_ols = OLS(n_realiz=100, alpha=0.05) stats_ols = model_ols.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.3.tar.gz.
File metadata
- Download URL: sarlib-0.0.3.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69ba1d30164deecdd76e2cf773044c605b5f4d7bcde34ef0a5daeced6d76e057
|
|
| MD5 |
f25e7454a648ab1b78e4c9673fdfee70
|
|
| BLAKE2b-256 |
bd066eaf7198b5f9afa2ecb0f332a5ef52ac3e61cd04f57e4cb84d23b7eec6bf
|
File details
Details for the file sarlib-0.0.3-py3-none-any.whl.
File metadata
- Download URL: sarlib-0.0.3-py3-none-any.whl
- Upload date:
- Size: 22.9 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 |
9b4aae44ce2892bc3836f4f0ec1da76a12564ceb612c358d566e1b3916091f2f
|
|
| MD5 |
6f5cbc3c8f408a17238b53b6cabd5e62
|
|
| BLAKE2b-256 |
23e397a65f83ab2578cf9ab8cd75963d8536945bde29079192366a5ac025c640
|