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
index.htmlautomated_reporting.py
index.html
Raw Download
Find: Go to:
<!DOCTYPE html>
<html lang="en">
<head>
    <!--
    Author: RSK World
    Website: https://rskworld.in
    Email: help@rskworld.in
    Phone: +91 93305 39277
    Description: Statsmodels Statistical Modeling Project Demo
    -->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Statsmodels Statistical Modeling - RSK World</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.3);
            overflow: hidden;
        }
        
        header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 40px;
            text-align: center;
        }
        
        header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
        }
        
        header p {
            font-size: 1.2em;
            opacity: 0.9;
        }
        
        .content {
            padding: 40px;
        }
        
        .section {
            margin-bottom: 40px;
        }
        
        .section h2 {
            color: #667eea;
            border-bottom: 3px solid #667eea;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        
        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }
        
        .feature-card {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            border-left: 4px solid #667eea;
            transition: transform 0.3s;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .feature-card h3 {
            color: #667eea;
            margin-bottom: 10px;
        }
        
        .tech-stack {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 15px;
        }
        
        .tech-badge {
            background: #667eea;
            color: white;
            padding: 8px 15px;
            border-radius: 20px;
            font-size: 0.9em;
        }
        
        .code-block {
            background: #2d2d2d;
            color: #f8f8f2;
            padding: 20px;
            border-radius: 5px;
            overflow-x: auto;
            margin: 20px 0;
        }
        
        .code-block code {
            font-family: 'Courier New', monospace;
        }
        
        .btn {
            display: inline-block;
            padding: 12px 30px;
            background: #667eea;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s;
            margin: 10px 10px 10px 0;
        }
        
        .btn:hover {
            background: #5568d3;
        }
        
        footer {
            background: #2d2d2d;
            color: white;
            padding: 30px;
            text-align: center;
        }
        
        footer a {
            color: #667eea;
            text-decoration: none;
        }
        
        footer a:hover {
            text-decoration: underline;
        }
        
        .author-info {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            margin-top: 30px;
        }
        
        .author-info h3 {
            color: #667eea;
            margin-bottom: 15px;
        }
        
        .author-info p {
            margin: 5px 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1><i class="fas fa-microscope"></i> Statsmodels Statistical Modeling</h1>
            <p>Advanced Statistical Analysis and Econometric Modeling</p>
        </header>
        
        <div class="content">
            <div class="section">
                <h2>About This Project</h2>
                <p>This project demonstrates Statsmodels, a powerful 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.</p>
            </div>
            
            <div class="section">
                <h2>Features</h2>
                <div class="features">
                    <div class="feature-card">
                        <h3>Linear & GLM Regression</h3>
                        <p>Comprehensive regression analysis with diagnostic tools and model validation.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Time Series Analysis</h3>
                        <p>ARIMA, SARIMA models, decomposition, forecasting, and stationarity testing.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Advanced Time Series</h3>
                        <p>Auto ARIMA selection, SARIMA models, comprehensive stationarity tests.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Hypothesis Testing</h3>
                        <p>T-tests, ANOVA, chi-square, normality tests, and non-parametric tests.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Statistical Diagnostics</h3>
                        <p>Comprehensive model diagnostics including multicollinearity, heteroscedasticity, and autocorrelation checks.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Econometric Modeling</h3>
                        <p>VAR, VARMAX models, cointegration tests, impulse response functions, and Granger causality.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Model Selection</h3>
                        <p>Stepwise selection, model comparison, information criteria (AIC, BIC, HQIC).</p>
                    </div>
                    <div class="feature-card">
                        <h3>Model Evaluation</h3>
                        <p>Cross-validation, time series CV, multiple metrics (MSE, MAE, R², MAPE), learning curves.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Feature Selection</h3>
                        <p>VIF-based removal, correlation filtering, automated feature selection.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Data Preprocessing</h3>
                        <p>Missing value handling, outlier detection/removal, scaling, stationarity transformation.</p>
                    </div>
                    <div class="feature-card">
                        <h3>Visualization</h3>
                        <p>Comprehensive plotting functions for all analyses including residuals, forecasts, and comparisons.</p>
                    </div>
                </div>
            </div>
            
            <div class="section">
                <h2>Technologies</h2>
                <div class="tech-stack">
                    <span class="tech-badge">Python</span>
                    <span class="tech-badge">Statsmodels</span>
                    <span class="tech-badge">Pandas</span>
                    <span class="tech-badge">NumPy</span>
                    <span class="tech-badge">Matplotlib</span>
                    <span class="tech-badge">Seaborn</span>
                    <span class="tech-badge">Scikit-learn</span>
                    <span class="tech-badge">SciPy</span>
                    <span class="tech-badge">Jupyter Notebook</span>
                </div>
            </div>
            
            <div class="section">
                <h2>Quick Start</h2>
                <div class="code-block">
                    <code>
# Install dependencies<br>
pip install -r requirements.txt<br><br>
# Run regression example<br>
python examples/regression_example.py<br><br>
# Run time series example<br>
python examples/time_series_example.py<br><br>
# Run hypothesis testing example<br>
python examples/hypothesis_testing_example.py
                    </code>
                </div>
            </div>
            
            <div class="section">
                <h2>Project Structure</h2>
                <div class="code-block">
                    <code>
statsmodels-statistical/<br>
├── regression_analysis.py<br>
├── time_series_analysis.py<br>
├── advanced_time_series.py<br>
├── hypothesis_testing.py<br>
├── statistical_diagnostics.py<br>
├── econometric_modeling.py<br>
├── model_selection.py<br>
├── model_evaluation.py<br>
├── data_preprocessing.py<br>
├── visualization_utils.py<br>
├── notebooks/<br>
│   ├── 01_linear_regression.ipynb<br>
│   ├── 02_time_series.ipynb<br>
│   ├── 03_hypothesis_testing.ipynb<br>
│   └── 04_econometric_modeling.ipynb<br>
├── examples/<br>
│   ├── regression_example.py<br>
│   ├── time_series_example.py<br>
│   ├── hypothesis_testing_example.py<br>
│   ├── model_selection_example.py<br>
│   └── advanced_time_series_example.py<br>
└── data/<br>
    └── sample_data.csv
                    </code>
                </div>
            </div>
            
            <div class="author-info">
                <h3>Project Author</h3>
                <p><strong>RSK World</strong></p>
                <p>Website: <a href="https://rskworld.in" target="_blank">https://rskworld.in</a></p>
                <p>Email: <a href="mailto:help@rskworld.in">help@rskworld.in</a></p>
                <p>Phone: +91 93305 39277</p>
            </div>
        </div>
        
        <footer>
            <p>&copy; 2025 RSK World. All rights reserved.</p>
            <p>Visit <a href="https://rskworld.in" target="_blank">rskworld.in</a> for more programming resources and source code.</p>
        </footer>
    </div>
</body>
</html>

315 lines•10.8 KB
markup
automated_reporting.py
Raw Download
Find: Go to:
"""
Automated Report Generation

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

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
import os
import warnings
warnings.filterwarnings('ignore')


class AutomatedReport:
    """
    Automated Statistical Report Generation
    
    Author: RSK World
    Website: https://rskworld.in
    Email: help@rskworld.in
    Phone: +91 93305 39277
    """
    
    def __init__(self, output_dir='reports'):
        """
        Initialize report generator
        
        Parameters:
        -----------
        output_dir : str
            Directory for reports
        """
        self.output_dir = output_dir
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)
        self.report_sections = []
    
    def add_section(self, title, content):
        """Add section to report"""
        self.report_sections.append({
            'title': title,
            'content': content,
            'timestamp': datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        })
    
    def generate_regression_report(self, model, X, y, model_name="Regression Model"):
        """
        Generate comprehensive regression report
        
        Parameters:
        -----------
        model : object
            Fitted regression model
        X : array-like
            Independent variables
        y : array-like
            Dependent variable
        model_name : str
            Name of the model
        """
        report = []
        report.append("=" * 80)
        report.append(f"REGRESSION ANALYSIS REPORT: {model_name}")
        report.append("=" * 80)
        report.append(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
        report.append("")
        
        # Model Summary
        report.append("MODEL SUMMARY")
        report.append("-" * 80)
        if hasattr(model, 'results'):
            results = model.results
            report.append(f"R-squared: {results.rsquared:.4f}")
            report.append(f"Adj. R-squared: {results.rsquared_adj:.4f}")
            report.append(f"F-statistic: {results.fvalue:.4f}")
            report.append(f"F p-value: {results.f_pvalue:.6f}")
            report.append(f"AIC: {results.aic:.4f}")
            report.append(f"BIC: {results.bic:.4f}")
            report.append("")
        
        # Coefficients
        report.append("COEFFICIENTS")
        report.append("-" * 80)
        if hasattr(model, 'results'):
            coef_df = pd.DataFrame({
                'Coefficient': results.params,
                'Std Error': results.bse,
                't-value': results.tvalues,
                'p-value': results.pvalues
            })
            report.append(coef_df.to_string())
            report.append("")
        
        # Diagnostics
        report.append("MODEL DIAGNOSTICS")
        report.append("-" * 80)
        
        if hasattr(model, 'check_multicollinearity'):
            try:
                vif = model.check_multicollinearity()
                report.append("\nVIF Results:")
                report.append(vif.to_string())
            except:
                pass
        
        if hasattr(model, 'check_heteroscedasticity'):
            try:
                het_result = model.check_heteroscedasticity()
                report.append(f"\nHeteroscedasticity Test: {het_result}")
            except:
                pass
        
        report_text = "\n".join(report)
        self.add_section(f"{model_name} Report", report_text)
        
        return report_text
    
    def generate_time_series_report(self, model, data, model_name="Time Series Model"):
        """Generate time series analysis report"""
        report = []
        report.append("=" * 80)
        report.append(f"TIME SERIES ANALYSIS REPORT: {model_name}")
        report.append("=" * 80)
        report.append(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
        report.append("")
        
        # Data Summary
        report.append("DATA SUMMARY")
        report.append("-" * 80)
        report.append(f"Number of observations: {len(data)}")
        report.append(f"Mean: {np.mean(data):.4f}")
        report.append(f"Std: {np.std(data):.4f}")
        report.append(f"Min: {np.min(data):.4f}")
        report.append(f"Max: {np.max(data):.4f}")
        report.append("")
        
        # Model Summary
        if hasattr(model, 'results'):
            report.append("MODEL SUMMARY")
            report.append("-" * 80)
            results = model.results
            report.append(f"AIC: {results.aic:.4f}")
            report.append(f"BIC: {results.bic:.4f}")
            report.append(f"Log Likelihood: {results.llf:.4f}")
            report.append("")
        
        report_text = "\n".join(report)
        self.add_section(f"{model_name} Report", report_text)
        
        return report_text
    
    def save_report(self, filename=None, format='txt'):
        """
        Save report to file
        
        Parameters:
        -----------
        filename : str
            Output filename
        format : str
            'txt' or 'html'
        """
        if filename is None:
            timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
            filename = f"report_{timestamp}"
        
        if format == 'txt':
            filepath = os.path.join(self.output_dir, f"{filename}.txt")
            with open(filepath, 'w', encoding='utf-8') as f:
                f.write("STATISTICAL ANALYSIS REPORT\n")
                f.write("=" * 80 + "\n")
                f.write(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
                f.write(f"Author: RSK World (https://rskworld.in)\n")
                f.write("=" * 80 + "\n\n")
                
                for section in self.report_sections:
                    f.write(section['content'])
                    f.write("\n\n")
            
            print(f"Report saved to: {filepath}")
            return filepath
        
        elif format == 'html':
            filepath = os.path.join(self.output_dir, f"{filename}.html")
            html_content = self._generate_html_report()
            with open(filepath, 'w', encoding='utf-8') as f:
                f.write(html_content)
            
            print(f"HTML report saved to: {filepath}")
            return filepath
    
    def _generate_html_report(self):
        """Generate HTML report"""
        html = f"""
<!DOCTYPE html>
<html>
<head>
    <title>Statistical Analysis Report</title>
    <style>
        body {{ font-family: Arial, sans-serif; margin: 20px; }}
        h1 {{ color: #333; }}
        h2 {{ color: #666; border-bottom: 2px solid #666; }}
        pre {{ background: #f5f5f5; padding: 10px; border-radius: 5px; }}
        .timestamp {{ color: #999; font-size: 0.9em; }}
    </style>
</head>
<body>
    <h1>Statistical Analysis Report</h1>
    <p class="timestamp">Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</p>
    <p class="timestamp">Author: RSK World (https://rskworld.in)</p>
"""
        
        for section in self.report_sections:
            html += f"<h2>{section['title']}</h2>\n"
            html += f"<pre>{section['content']}</pre>\n"
        
        html += """
</body>
</html>
"""
        return html
    
    def clear_report(self):
        """Clear all report sections"""
        self.report_sections = []


if __name__ == "__main__":
    # Example usage
    print("Automated Reporting Example")
    print("=" * 70)
    
    from regression_analysis import LinearRegressionModel
    import numpy as np
    
    # Generate sample data
    np.random.seed(42)
    X = np.random.randn(100, 3)
    y = 2 + 1.5 * X[:, 0] + 0.8 * X[:, 1] - 0.5 * X[:, 2] + np.random.randn(100) * 0.5
    
    # Fit model
    model = LinearRegressionModel()
    model.fit(X, y)
    
    # Generate report
    reporter = AutomatedReport()
    reporter.generate_regression_report(model, X, y, "Sample Regression")
    
    # Save report
    reporter.save_report("regression_report", format='txt')
    reporter.save_report("regression_report", format='html')

258 lines•8.3 KB
python
🚀 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