x13-seasonal-adjustment


Namex13-seasonal-adjustment JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryComprehensive X13-ARIMA-SEATS seasonal adjustment library for Python
upload_time2025-08-28 12:31:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Gardaş Habbasov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords time-series seasonal-adjustment x13 arima econometrics statistics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # X13 Seasonal Adjustment

[![PyPI version](https://badge.fury.io/py/x13-seasonal-adjustment.svg)](https://badge.fury.io/py/x13-seasonal-adjustment)
[![Python Version](https://img.shields.io/pypi/pyversions/x13-seasonal-adjustment.svg)](https://pypi.org/project/x13-seasonal-adjustment/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation Status](https://readthedocs.org/projects/x13-seasonal-adjustment/badge/?version=latest)](https://x13-seasonal-adjustment.readthedocs.io/en/latest/?badge=latest)

A comprehensive Python implementation of the X13-ARIMA-SEATS seasonal adjustment algorithm. This library provides robust tools for detecting and removing seasonal effects from time series data.

## Features

- **Automatic Seasonality Detection**: Advanced statistical tests for seasonality identification
- **X13-ARIMA-SEATS Algorithm**: International standard seasonal adjustment methodology
- **High Performance**: Optimized computations using NumPy and SciPy
- **Visualization**: Comprehensive plotting capabilities with matplotlib
- **Flexible API**: Suitable for both simple and advanced use cases
- **Comprehensive Documentation**: Detailed documentation and examples
- **Full Test Coverage**: Reliable code with 95%+ test coverage

## Kurulum

```bash
pip install x13-seasonal-adjustment
```

Geliştirme versiyonu için:

```bash
pip install x13-seasonal-adjustment[dev]
```

## Hızlı Başlangıç

```python
import pandas as pd
from x13_seasonal_adjustment import X13SeasonalAdjustment

# Veri yükle
data = pd.read_csv('your_time_series.csv', index_col=0, parse_dates=True)

# X13 modeli oluştur
x13 = X13SeasonalAdjustment()

# Mevsimsellikten arındırma
result = x13.fit_transform(data['value'])

# Sonuçları görüntüle
print("Orijinal Seri:", result.original)
print("Mevsimsellikten Arındırılmış Seri:", result.seasonally_adjusted)
print("Mevsimsel Faktörler:", result.seasonal_factors)
print("Trend:", result.trend)

# Grafik çizimi
result.plot()
```

## Ana Bileşenler

### 1. X13SeasonalAdjustment (Ana Sınıf)
```python
from x13_seasonal_adjustment import X13SeasonalAdjustment

x13 = X13SeasonalAdjustment(
    freq='M',           # Veri frekansı (M=Aylık, Q=Çeyreklik)
    transform='auto',   # Logaritmik dönüşüm ('auto', 'log', 'none')
    outlier_detection=True,  # Aykırı değer tespiti
    trading_day=True,   # İş günü etkisi
    easter=True,        # Paskalya etkisi
    arima_order='auto'  # ARIMA model sırası
)
```

### 2. Mevsimsellik Testleri
```python
from x13_seasonal_adjustment.tests import SeasonalityTests

tests = SeasonalityTests()
result = tests.run_all_tests(data)
print(f"Mevsimsellik var mı? {result.has_seasonality}")
```

### 3. ARIMA Modelleme
```python
from x13_seasonal_adjustment.arima import AutoARIMA

arima = AutoARIMA()
model = arima.fit(data)
forecast = model.forecast(steps=12)
```

## Metodoloji

Bu kütüphane, ABD Sayım Bürosu'nun X13-ARIMA-SEATS programının metodolojisini takip eder:

1. **Ön İşleme**: Eksik değer doldurma, aykırı değer tespiti
2. **Model Seçimi**: Otomatik ARIMA model seçimi
3. **Mevsimsel Dekompozisyon**: X11 algoritması ile dekompozisyon
4. **Kalite Kontrolü**: M ve Q istatistikleri ile kalite değerlendirmesi

## Örnekler

### Temel Kullanım
```python
import numpy as np
import pandas as pd
from x13_seasonal_adjustment import X13SeasonalAdjustment

# Örnek veri oluştur
dates = pd.date_range('2020-01-01', periods=60, freq='M')
trend = np.linspace(100, 200, 60)
seasonal = 10 * np.sin(2 * np.pi * np.arange(60) / 12)
noise = np.random.normal(0, 5, 60)
data = pd.Series(trend + seasonal + noise, index=dates)

# Mevsimsellikten arındır
x13 = X13SeasonalAdjustment()
result = x13.fit_transform(data)

# Sonuçları analiz et
print(f"Mevsimsellik derecesi: {result.seasonality_strength:.3f}")
print(f"Trend gücü: {result.trend_strength:.3f}")
```

### İleri Seviye Kullanım
```python
from x13_seasonal_adjustment import X13SeasonalAdjustment
from x13_seasonal_adjustment.diagnostics import QualityDiagnostics

# Özelleştirilmiş model
x13 = X13SeasonalAdjustment(
    transform='log',
    outlier_detection=True,
    outlier_types=['AO', 'LS', 'TC'],  # Aykırı değer tipleri
    arima_order=(0, 1, 1),             # Manuel ARIMA sırası
    seasonal_arima_order=(0, 1, 1),    # Mevsimsel ARIMA sırası
)

result = x13.fit_transform(data)

# Kalite diagnostikleri
diagnostics = QualityDiagnostics()
quality_report = diagnostics.evaluate(result)
print(quality_report)
```

## API Referansı

### X13SeasonalAdjustment

**Parameters:**
- `freq` (str): Data frequency ('M', 'Q', 'A')
- `transform` (str): Transformation type ('auto', 'log', 'none')
- `outlier_detection` (bool): Enable outlier detection?
- `trading_day` (bool): Model trading day effects?
- `easter` (bool): Model Easter effects?
- `arima_order` (tuple or 'auto'): ARIMA model order

**Methods:**
- `fit(X)`: Train the model
- `transform(X)`: Apply seasonal adjustment
- `fit_transform(X)`: Train and transform
- `plot_decomposition()`: Plot decomposition chart

### SeasonalAdjustmentResult

**Properties:**
- `original`: Original series
- `seasonally_adjusted`: Seasonally adjusted series
- `seasonal_factors`: Seasonal factors
- `trend`: Trend component
- `irregular`: Irregular component
- `seasonality_strength`: Seasonality strength (0-1)
- `trend_strength`: Trend strength (0-1)

## Katkıda Bulunma

Bu projeye katkıda bulunmak istiyorsanız:

1. Repository'yi fork edin
2. Feature branch oluşturun (`git checkout -b feature/amazing-feature`)
3. Değişikliklerinizi commit edin (`git commit -m 'Add amazing feature'`)
4. Branch'inizi push edin (`git push origin feature/amazing-feature`)
5. Pull Request oluşturun

## Geliştirme Ortamı

```bash
# Repository'yi klonlayın
git clone https://github.com/gardashabbasov/x13-seasonal-adjustment.git
cd x13-seasonal-adjustment

# Geliştirme bağımlılıklarını yükleyin
pip install -e .[dev]

# Testleri çalıştırın
pytest

# Code style kontrolü
black src/ tests/
flake8 src/ tests/

# Type checking
mypy src/
```

## Lisans

Bu proje MIT lisansı altında lisanslanmıştır. Detaylar için [LICENSE](LICENSE) dosyasına bakın.

## Contact

- **Developer**: Gardash Abbasov
- **Email**: gardash.abbasov@gmail.com
- **GitHub**: [@Gardash023](https://github.com/Gardash023)

## Acknowledgments

- US Census Bureau's X13-ARIMA-SEATS program
- Statsmodels, NumPy, SciPy, Pandas communities
- International econometrics and statistics community

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for detailed version history.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "x13-seasonal-adjustment",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Gardash Abbasov <gardash.abbasov@gmail.com>",
    "keywords": "time-series, seasonal-adjustment, x13, arima, econometrics, statistics",
    "author": null,
    "author_email": "Gardash Abbasov <gardash.abbasov@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/27/ac/af76dda5baf72d4026a88c97b80d92282a7120a36c94edebb28214936a78/x13_seasonal_adjustment-0.1.3.tar.gz",
    "platform": null,
    "description": "# X13 Seasonal Adjustment\n\n[![PyPI version](https://badge.fury.io/py/x13-seasonal-adjustment.svg)](https://badge.fury.io/py/x13-seasonal-adjustment)\n[![Python Version](https://img.shields.io/pypi/pyversions/x13-seasonal-adjustment.svg)](https://pypi.org/project/x13-seasonal-adjustment/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation Status](https://readthedocs.org/projects/x13-seasonal-adjustment/badge/?version=latest)](https://x13-seasonal-adjustment.readthedocs.io/en/latest/?badge=latest)\n\nA comprehensive Python implementation of the X13-ARIMA-SEATS seasonal adjustment algorithm. This library provides robust tools for detecting and removing seasonal effects from time series data.\n\n## Features\n\n- **Automatic Seasonality Detection**: Advanced statistical tests for seasonality identification\n- **X13-ARIMA-SEATS Algorithm**: International standard seasonal adjustment methodology\n- **High Performance**: Optimized computations using NumPy and SciPy\n- **Visualization**: Comprehensive plotting capabilities with matplotlib\n- **Flexible API**: Suitable for both simple and advanced use cases\n- **Comprehensive Documentation**: Detailed documentation and examples\n- **Full Test Coverage**: Reliable code with 95%+ test coverage\n\n## Kurulum\n\n```bash\npip install x13-seasonal-adjustment\n```\n\nGeli\u015ftirme versiyonu i\u00e7in:\n\n```bash\npip install x13-seasonal-adjustment[dev]\n```\n\n## H\u0131zl\u0131 Ba\u015flang\u0131\u00e7\n\n```python\nimport pandas as pd\nfrom x13_seasonal_adjustment import X13SeasonalAdjustment\n\n# Veri y\u00fckle\ndata = pd.read_csv('your_time_series.csv', index_col=0, parse_dates=True)\n\n# X13 modeli olu\u015ftur\nx13 = X13SeasonalAdjustment()\n\n# Mevsimsellikten ar\u0131nd\u0131rma\nresult = x13.fit_transform(data['value'])\n\n# Sonu\u00e7lar\u0131 g\u00f6r\u00fcnt\u00fcle\nprint(\"Orijinal Seri:\", result.original)\nprint(\"Mevsimsellikten Ar\u0131nd\u0131r\u0131lm\u0131\u015f Seri:\", result.seasonally_adjusted)\nprint(\"Mevsimsel Fakt\u00f6rler:\", result.seasonal_factors)\nprint(\"Trend:\", result.trend)\n\n# Grafik \u00e7izimi\nresult.plot()\n```\n\n## Ana Bile\u015fenler\n\n### 1. X13SeasonalAdjustment (Ana S\u0131n\u0131f)\n```python\nfrom x13_seasonal_adjustment import X13SeasonalAdjustment\n\nx13 = X13SeasonalAdjustment(\n    freq='M',           # Veri frekans\u0131 (M=Ayl\u0131k, Q=\u00c7eyreklik)\n    transform='auto',   # Logaritmik d\u00f6n\u00fc\u015f\u00fcm ('auto', 'log', 'none')\n    outlier_detection=True,  # Ayk\u0131r\u0131 de\u011fer tespiti\n    trading_day=True,   # \u0130\u015f g\u00fcn\u00fc etkisi\n    easter=True,        # Paskalya etkisi\n    arima_order='auto'  # ARIMA model s\u0131ras\u0131\n)\n```\n\n### 2. Mevsimsellik Testleri\n```python\nfrom x13_seasonal_adjustment.tests import SeasonalityTests\n\ntests = SeasonalityTests()\nresult = tests.run_all_tests(data)\nprint(f\"Mevsimsellik var m\u0131? {result.has_seasonality}\")\n```\n\n### 3. ARIMA Modelleme\n```python\nfrom x13_seasonal_adjustment.arima import AutoARIMA\n\narima = AutoARIMA()\nmodel = arima.fit(data)\nforecast = model.forecast(steps=12)\n```\n\n## Metodoloji\n\nBu k\u00fct\u00fcphane, ABD Say\u0131m B\u00fcrosu'nun X13-ARIMA-SEATS program\u0131n\u0131n metodolojisini takip eder:\n\n1. **\u00d6n \u0130\u015fleme**: Eksik de\u011fer doldurma, ayk\u0131r\u0131 de\u011fer tespiti\n2. **Model Se\u00e7imi**: Otomatik ARIMA model se\u00e7imi\n3. **Mevsimsel Dekompozisyon**: X11 algoritmas\u0131 ile dekompozisyon\n4. **Kalite Kontrol\u00fc**: M ve Q istatistikleri ile kalite de\u011ferlendirmesi\n\n## \u00d6rnekler\n\n### Temel Kullan\u0131m\n```python\nimport numpy as np\nimport pandas as pd\nfrom x13_seasonal_adjustment import X13SeasonalAdjustment\n\n# \u00d6rnek veri olu\u015ftur\ndates = pd.date_range('2020-01-01', periods=60, freq='M')\ntrend = np.linspace(100, 200, 60)\nseasonal = 10 * np.sin(2 * np.pi * np.arange(60) / 12)\nnoise = np.random.normal(0, 5, 60)\ndata = pd.Series(trend + seasonal + noise, index=dates)\n\n# Mevsimsellikten ar\u0131nd\u0131r\nx13 = X13SeasonalAdjustment()\nresult = x13.fit_transform(data)\n\n# Sonu\u00e7lar\u0131 analiz et\nprint(f\"Mevsimsellik derecesi: {result.seasonality_strength:.3f}\")\nprint(f\"Trend g\u00fcc\u00fc: {result.trend_strength:.3f}\")\n```\n\n### \u0130leri Seviye Kullan\u0131m\n```python\nfrom x13_seasonal_adjustment import X13SeasonalAdjustment\nfrom x13_seasonal_adjustment.diagnostics import QualityDiagnostics\n\n# \u00d6zelle\u015ftirilmi\u015f model\nx13 = X13SeasonalAdjustment(\n    transform='log',\n    outlier_detection=True,\n    outlier_types=['AO', 'LS', 'TC'],  # Ayk\u0131r\u0131 de\u011fer tipleri\n    arima_order=(0, 1, 1),             # Manuel ARIMA s\u0131ras\u0131\n    seasonal_arima_order=(0, 1, 1),    # Mevsimsel ARIMA s\u0131ras\u0131\n)\n\nresult = x13.fit_transform(data)\n\n# Kalite diagnostikleri\ndiagnostics = QualityDiagnostics()\nquality_report = diagnostics.evaluate(result)\nprint(quality_report)\n```\n\n## API Referans\u0131\n\n### X13SeasonalAdjustment\n\n**Parameters:**\n- `freq` (str): Data frequency ('M', 'Q', 'A')\n- `transform` (str): Transformation type ('auto', 'log', 'none')\n- `outlier_detection` (bool): Enable outlier detection?\n- `trading_day` (bool): Model trading day effects?\n- `easter` (bool): Model Easter effects?\n- `arima_order` (tuple or 'auto'): ARIMA model order\n\n**Methods:**\n- `fit(X)`: Train the model\n- `transform(X)`: Apply seasonal adjustment\n- `fit_transform(X)`: Train and transform\n- `plot_decomposition()`: Plot decomposition chart\n\n### SeasonalAdjustmentResult\n\n**Properties:**\n- `original`: Original series\n- `seasonally_adjusted`: Seasonally adjusted series\n- `seasonal_factors`: Seasonal factors\n- `trend`: Trend component\n- `irregular`: Irregular component\n- `seasonality_strength`: Seasonality strength (0-1)\n- `trend_strength`: Trend strength (0-1)\n\n## Katk\u0131da Bulunma\n\nBu projeye katk\u0131da bulunmak istiyorsan\u0131z:\n\n1. Repository'yi fork edin\n2. Feature branch olu\u015fturun (`git checkout -b feature/amazing-feature`)\n3. De\u011fi\u015fikliklerinizi commit edin (`git commit -m 'Add amazing feature'`)\n4. Branch'inizi push edin (`git push origin feature/amazing-feature`)\n5. Pull Request olu\u015fturun\n\n## Geli\u015ftirme Ortam\u0131\n\n```bash\n# Repository'yi klonlay\u0131n\ngit clone https://github.com/gardashabbasov/x13-seasonal-adjustment.git\ncd x13-seasonal-adjustment\n\n# Geli\u015ftirme ba\u011f\u0131ml\u0131l\u0131klar\u0131n\u0131 y\u00fckleyin\npip install -e .[dev]\n\n# Testleri \u00e7al\u0131\u015ft\u0131r\u0131n\npytest\n\n# Code style kontrol\u00fc\nblack src/ tests/\nflake8 src/ tests/\n\n# Type checking\nmypy src/\n```\n\n## Lisans\n\nBu proje MIT lisans\u0131 alt\u0131nda lisanslanm\u0131\u015ft\u0131r. Detaylar i\u00e7in [LICENSE](LICENSE) dosyas\u0131na bak\u0131n.\n\n## Contact\n\n- **Developer**: Gardash Abbasov\n- **Email**: gardash.abbasov@gmail.com\n- **GitHub**: [@Gardash023](https://github.com/Gardash023)\n\n## Acknowledgments\n\n- US Census Bureau's X13-ARIMA-SEATS program\n- Statsmodels, NumPy, SciPy, Pandas communities\n- International econometrics and statistics community\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for detailed version history.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 Garda\u015f Habbasov\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "Comprehensive X13-ARIMA-SEATS seasonal adjustment library for Python",
    "version": "0.1.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/Gardash023/x13-seasonal-adjustment/issues",
        "Documentation": "https://x13-seasonal-adjustment.readthedocs.io",
        "Homepage": "https://github.com/Gardash023/x13-seasonal-adjustment",
        "Repository": "https://github.com/Gardash023/x13-seasonal-adjustment"
    },
    "split_keywords": [
        "time-series",
        " seasonal-adjustment",
        " x13",
        " arima",
        " econometrics",
        " statistics"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "66acf49d645411b64a0386f73de8ca822b21a8babf300d68f7c608db071781e4",
                "md5": "282e07f5d734a997468bcdd0a2c766d3",
                "sha256": "36b5f3770777e9296c41d401cdfa8034fee48eebfd34c836c840b3742ee33c5a"
            },
            "downloads": -1,
            "filename": "x13_seasonal_adjustment-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "282e07f5d734a997468bcdd0a2c766d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 42553,
            "upload_time": "2025-08-28T12:31:23",
            "upload_time_iso_8601": "2025-08-28T12:31:23.071114Z",
            "url": "https://files.pythonhosted.org/packages/66/ac/f49d645411b64a0386f73de8ca822b21a8babf300d68f7c608db071781e4/x13_seasonal_adjustment-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "27acaf76dda5baf72d4026a88c97b80d92282a7120a36c94edebb28214936a78",
                "md5": "20e9f6b7fa0dc0c4b778cc9d2c52ce83",
                "sha256": "f9014b36016649ec3f93a4311e91ab90742b2f5a11d4a496e8efc0728fd6d4a8"
            },
            "downloads": -1,
            "filename": "x13_seasonal_adjustment-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "20e9f6b7fa0dc0c4b778cc9d2c52ce83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 54300,
            "upload_time": "2025-08-28T12:31:24",
            "upload_time_iso_8601": "2025-08-28T12:31:24.872525Z",
            "url": "https://files.pythonhosted.org/packages/27/ac/af76dda5baf72d4026a88c97b80d92282a7120a36c94edebb28214936a78/x13_seasonal_adjustment-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-28 12:31:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Gardash023",
    "github_project": "x13-seasonal-adjustment",
    "github_not_found": true,
    "lcname": "x13-seasonal-adjustment"
}
        
Elapsed time: 0.57172s