help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
statsmodels-statistical
RSK World
statsmodels-statistical
Statistical Modeling with Statsmodels
statsmodels-statistical
  • __pycache__
  • data
  • examples
  • notebooks
  • .gitignore458 B
  • CHANGELOG.md4 KB
  • FEATURES.md6.3 KB
  • LICENSE1.2 KB
  • PROJECT_INFO.md2.2 KB
  • PROJECT_SUMMARY.md4.2 KB
  • README.md7.4 KB
  • RELEASE_NOTES_v1.0.0.md6.5 KB
  • UNIQUE_FEATURES.md5.3 KB
  • advanced_time_series.py9.8 KB
  • automated_reporting.py8.3 KB
  • bayesian_statistics.py7.5 KB
  • data_preprocessing.py8.2 KB
  • econometric_modeling.py9.8 KB
  • hypothesis_testing.py12.5 KB
  • index.html10.8 KB
  • model_evaluation.py9.1 KB
  • model_persistence.py6.5 KB
  • model_selection.py9.7 KB
  • panel_data_analysis.py7.3 KB
  • performance_benchmarking.py7.3 KB
  • regression_analysis.py9 KB
  • requirements.txt361 B
  • statistical_diagnostics.py13.8 KB
  • statsmodels-statistical.png284 B
  • time_series_analysis.py10.3 KB
  • visualization_utils.py8.9 KB
README.mdcreate_zip.pydashboard.htmlconvert_format.pyRELEASE_NOTES_v1.0.0.md
README.md
Raw Download

README.md

# Statsmodels Statistical Modeling

<!--
Author: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Description: Statistical modeling with Statsmodels including regression analysis, time series models, hypothesis testing, and statistical tests.
-->

Statistical modeling with Statsmodels including regression analysis, time series models, hypothesis testing, and statistical tests.

## Description

This project demonstrates Statsmodels, a library for statistical modeling and econometrics in Python. It covers linear and generalized linear models, time series analysis, hypothesis testing, statistical tests, and diagnostic tools. Perfect for statistical analysis and econometric modeling.

## Features

- **Linear and GLM regression** - OLS, GLM with multiple families, comprehensive diagnostics
- **Time series analysis** - ARIMA, SARIMA, exponential smoothing, decomposition, forecasting
- **Advanced time series** - Auto ARIMA selection, SARIMA models, comprehensive stationarity tests
- **Hypothesis testing** - T-tests, ANOVA, chi-square, normality tests, non-parametric tests
- **Statistical diagnostics** - Multicollinearity, heteroscedasticity, autocorrelation, influential points
- **Econometric modeling** - VAR, VARMAX, cointegration tests, impulse response functions, Granger causality
- **Model selection** - Stepwise selection, model comparison, information criteria
- **Model evaluation** - Cross-validation, time series CV, multiple metrics, learning curves
- **Feature selection** - VIF-based removal, correlation filtering
- **Data preprocessing** - Missing value handling, outlier detection/removal, scaling, stationarity transformation
- **Visualization utilities** - Comprehensive plotting functions for all analyses
- **Bayesian statistics** - Bayesian inference, posterior distributions, Bayes factors
- **Panel data analysis** - Fixed effects, random effects, Hausman test
- **Model persistence** - Save/load models, model serialization, metadata management
- **Automated reporting** - Generate comprehensive reports in TXT and HTML formats
- **Performance benchmarking** - Model comparison, execution time profiling, memory usage

## Technologies

- Python 3.8+
- Statsmodels
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
- SciPy
- Jupyter Notebook

## Installation

```bash
pip install -r requirements.txt
```

## Usage

### Linear Regression

```python
from regression_analysis import LinearRegressionModel

# Create and fit model
model = LinearRegressionModel()
model.fit(X, y)
model.summary()
```

### Time Series Analysis

```python
from time_series_analysis import TimeSeriesModel

# Create and fit time series model
ts_model = TimeSeriesModel()
ts_model.fit(data)
ts_model.forecast(steps=10)
```

### Hypothesis Testing

```python
from hypothesis_testing import StatisticalTests

# Perform statistical tests
tests = StatisticalTests()
tests.t_test(data)
tests.chi_square_test(data)
```

### Model Selection

```python
from model_selection import ModelSelection

# Compare multiple models
selector = ModelSelection()
comparison = selector.compare_models(X, y, models_dict)

# Stepwise feature selection
features, model = selector.stepwise_selection(X, y)
```

### Model Evaluation

```python
from model_evaluation import ModelEvaluation

# Cross-validation
evaluator = ModelEvaluation()
cv_results = evaluator.cross_validate(X, y, model_func, cv_folds=5)

# Calculate metrics
metrics = evaluator.calculate_metrics(y_true, y_pred)
```

### Advanced Time Series

```python
from advanced_time_series import SARIMAModel, AutoARIMA

# SARIMA model
sarima = SARIMAModel()
sarima.fit(data, order=(1,1,1), seasonal_order=(1,1,1,12))

# Auto ARIMA selection
auto_arima = AutoARIMA()
best_model = auto_arima.auto_select(data)
```

### Data Preprocessing

```python
from data_preprocessing import DataPreprocessor

# Handle missing values and outliers
preprocessor = DataPreprocessor()
cleaned_data = preprocessor.remove_outliers(data)
scaled_data = preprocessor.scale_data(data, method='standard')
```

### Visualization

```python
from visualization_utils import StatisticalVisualizations

# Create comprehensive plots
viz = StatisticalVisualizations()
viz.plot_correlation_matrix(data)
viz.plot_residual_analysis(residuals, fitted_values)
```

### Bayesian Statistics

```python
from bayesian_statistics import BayesianAnalysis

# Bayesian t-test
result = BayesianAnalysis.bayesian_ttest(sample1, sample2)

# Bayesian linear regression
bayesian_result = BayesianAnalysis.bayesian_linear_regression(X, y)
```

### Panel Data Analysis

```python
from panel_data_analysis import PanelDataAnalysis

# Prepare and analyze panel data
panel = PanelDataAnalysis()
panel.prepare_panel_data(df, 'entity', 'time', ['X1', 'X2', 'y'])
fe_model = panel.fixed_effects_regression('y', ['X1', 'X2'])
```

### Model Persistence

```python
from model_persistence import ModelPersistence

# Save and load models
persistence = ModelPersistence()
persistence.save_model(model, 'my_model', metadata={'r_squared': 0.95})
loaded_model, metadata = persistence.load_model('saved_models/my_model.pkl')
```

### Automated Reporting

```python
from automated_reporting import AutomatedReport

# Generate comprehensive reports
reporter = AutomatedReport()
reporter.generate_regression_report(model, X, y)
reporter.save_report('analysis_report', format='html')
```

### Performance Benchmarking

```python
from performance_benchmarking import PerformanceBenchmark

# Benchmark model performance
benchmark = PerformanceBenchmark()
comparison = benchmark.compare_models(models_dict, X, y)
```

## Project Structure

```
statsmodels-statistical/
├── README.md
├── requirements.txt
├── LICENSE
├── index.html
├── regression_analysis.py # Linear and GLM regression
├── time_series_analysis.py # Basic time series models
├── advanced_time_series.py # SARIMA, Auto ARIMA
├── hypothesis_testing.py # Statistical tests
├── statistical_diagnostics.py # Model diagnostics
├── econometric_modeling.py # VAR, cointegration
├── model_selection.py # Model comparison, stepwise selection
├── model_evaluation.py # Cross-validation, metrics
├── data_preprocessing.py # Data cleaning, scaling
├── visualization_utils.py # Advanced plotting
├── bayesian_statistics.py # Bayesian inference
├── panel_data_analysis.py # Panel data models
├── model_persistence.py # Model saving/loading
├── automated_reporting.py # Report generation
├── performance_benchmarking.py # Performance profiling
├── notebooks/
│ ├── 01_linear_regression.ipynb
│ ├── 02_time_series.ipynb
│ ├── 03_hypothesis_testing.ipynb
│ └── 04_econometric_modeling.ipynb
├── data/
│ └── sample_data.csv
└── examples/
├── regression_example.py
├── time_series_example.py
└── hypothesis_testing_example.py
```

## Author

**RSK World**
- Website: https://rskworld.in
- Email: help@rskworld.in
- Phone: +91 93305 39277

## License

This project is provided as educational material for statistical modeling and analysis.

RELEASE_NOTES_v1.0.0.md
Raw Download

RELEASE_NOTES_v1.0.0.md

# Release Notes - v1.0.0

**Initial Release** - January 2025

## 🎉 Statsmodels Statistical Modeling Library

A comprehensive Python library for statistical modeling, econometric analysis, and time series forecasting using Statsmodels.

**Author:** RSK World
**Website:** https://rskworld.in
**Repository:** https://github.com/rskworld/statsmodels-statistical

---

## ✨ Key Features

### 📊 Regression Analysis
- **Linear Regression (OLS)** with comprehensive diagnostics
- **Generalized Linear Models (GLM)** with multiple families
- Residual analysis and diagnostic plots
- Multicollinearity, heteroscedasticity, and autocorrelation tests

### 📈 Time Series Analysis
- **ARIMA Models** for univariate time series
- **SARIMA Models** with seasonal components
- **Auto ARIMA** for automatic model selection
- Time series decomposition (trend, seasonal, residual)
- Stationarity tests (ADF, KPSS)
- ACF/PACF analysis
- Exponential smoothing (Holt-Winters)
- Vector Autoregression (VAR)

### 🧪 Hypothesis Testing
- Parametric tests (t-test, z-test, ANOVA, chi-square)
- Non-parametric tests (Mann-Whitney, Kruskal-Wallis)
- Normality tests (Shapiro-Wilk, Jarque-Bera, Lilliefors)
- Proportion tests
- Comprehensive test results with interpretations

### 📉 Econometric Modeling
- **VAR Models** with optimal lag selection
- **VARMAX Models** with moving average components
- **Cointegration Tests** (Johansen, Engle-Granger)
- **Impulse Response Functions (IRF)**
- **Forecast Error Variance Decomposition (FEVD)**
- **Granger Causality** testing

### 🔍 Model Selection & Evaluation
- Model comparison using AIC, BIC, R²
- Stepwise feature selection (forward/backward)
- K-fold and time series cross-validation
- Multiple evaluation metrics (MSE, RMSE, MAE, MAPE, R²)
- Learning curves
- Feature importance analysis

### 🛠️ Data Preprocessing
- Missing value handling (mean, median, mode, forward fill)
- Outlier detection and removal (IQR, Z-score)
- Data scaling (Standard, MinMax, Robust)
- Time series transformations (differencing, detrending)
- Feature engineering (lags, rolling windows)

### 📊 Visualization Utilities
- Correlation matrix heatmaps
- Distribution plots with KDE
- Time series plots
- Residual analysis plots
- ACF/PACF plots
- Forecast comparison plots
- Model comparison charts
- Feature importance visualizations

### 🎯 Advanced Features
- **Bayesian Statistics** (Bayesian t-test, linear regression, posterior distributions)
- **Panel Data Analysis** (Fixed effects, Random effects, Hausman test)
- **Model Persistence** (Save/load models, serialization)
- **Automated Reporting** (TXT and HTML report generation)
- **Performance Benchmarking** (Execution time, memory usage)

---

## 📦 What's Included

### Python Modules (15 files)
- `regression_analysis.py` - Linear and GLM regression
- `time_series_analysis.py` - Basic time series models
- `advanced_time_series.py` - SARIMA, Auto ARIMA
- `hypothesis_testing.py` - Statistical tests
- `statistical_diagnostics.py` - Model diagnostics
- `econometric_modeling.py` - VAR, VARMAX, cointegration
- `model_selection.py` - Model comparison and selection
- `model_evaluation.py` - Cross-validation and metrics
- `data_preprocessing.py` - Data cleaning and transformation
- `visualization_utils.py` - Advanced plotting functions
- `bayesian_statistics.py` - Bayesian inference
- `panel_data_analysis.py` - Panel data models
- `model_persistence.py` - Model saving/loading
- `automated_reporting.py` - Report generation
- `performance_benchmarking.py` - Performance profiling

### Jupyter Notebooks (4 files)
- `01_linear_regression.ipynb`
- `02_time_series.ipynb`
- `03_hypothesis_testing.ipynb`
- `04_econometric_modeling.ipynb`

### Example Scripts (5 files)
- `examples/regression_example.py`
- `examples/time_series_example.py`
- `examples/hypothesis_testing_example.py`
- `examples/model_selection_example.py`
- `examples/advanced_time_series_example.py`

### Documentation
- Comprehensive README with usage examples
- Detailed FEATURES.md
- CHANGELOG.md
- Project documentation files

### Sample Data
- Sample datasets for testing and examples

---

## 🚀 Quick Start

### Installation

```bash
# Clone the repository
git clone https://github.com/rskworld/statsmodels-statistical.git
cd statsmodels-statistical

# Install dependencies
pip install -r requirements.txt
```

### Basic Usage

```python
# Linear Regression
from regression_analysis import LinearRegressionModel

model = LinearRegressionModel()
model.fit(X, y)
model.summary()

# Time Series Analysis
from time_series_analysis import TimeSeriesModel

ts_model = TimeSeriesModel()
ts_model.fit_arima(data, order=(1, 1, 1))
forecast, conf_int = ts_model.forecast(steps=10)

# Hypothesis Testing
from hypothesis_testing import StatisticalTests

tests = StatisticalTests()
tests.t_test(sample1, sample2)
tests.anova_test(data_dict)
```

---

## 📋 Requirements

- Python 3.8+
- statsmodels >= 0.14.0
- pandas >= 2.0.0
- numpy >= 1.24.0
- matplotlib >= 3.7.0
- seaborn >= 0.12.0
- scipy >= 1.10.0
- scikit-learn >= 1.3.0
- jupyter >= 1.0.0

---

## 🐛 Bug Fixes in This Release

- Fixed deprecated pandas `fillna(method='ffill')` → `ffill()`
- Added missing `scipy.stats` import in panel data analysis
- Fixed potential AttributeError in AutoARIMA initialization

---

## 📝 Documentation

- **README.md** - Complete project documentation with examples
- **FEATURES.md** - Detailed feature list
- **CHANGELOG.md** - Version history
- **Jupyter Notebooks** - Interactive tutorials

---

## 🤝 Contributing

This is an open-source project. Contributions are welcome!

---

## 📄 License

This project is provided as educational material for statistical modeling and analysis.

---

## 👤 Author

**RSK World**
- Website: https://rskworld.in
- Email: help@rskworld.in
- Phone: +91 93305 39277

---

## 🔗 Links

- **GitHub Repository:** https://github.com/rskworld/statsmodels-statistical
- **Website:** https://rskworld.in
- **Documentation:** See README.md

---

## 🙏 Acknowledgments

Built with:
- [Statsmodels](https://www.statsmodels.org/) - Statistical modeling library
- [Pandas](https://pandas.pydata.org/) - Data manipulation
- [NumPy](https://numpy.org/) - Numerical computing
- [Matplotlib](https://matplotlib.org/) - Visualization
- [SciPy](https://scipy.org/) - Scientific computing

---

**Release Date:** January 2025
**Version:** 1.0.0
**Status:** Stable

🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer