Skip to main content

a Python package for analyzing the correlation between macroeconomic indicators and time-series data

Project description

macroecon

Macrocorr (’macroeconomic correlation’) is a Python package for analyzing the correlation between macroeconomic indicators and time-series data.

Pearson's correlation is used to analyze the correlation. This package uses SciPy’s built function to get the Pearson coefficient. For details, please check out scipy.stats.pearsonr.

This package is designed to provide the easy process of analyzing and comparing the correlations with multiple macroeconomic indicators at a single time. The result is intended to provide an overview of macroeconomic relationships. It should not be used for profitable purposes.

The data of the macroeconomic indicators are extracted from WorldBank and YahooFinance historical database. This package doesn’t guarantee the accuracy of the correlated data.

Installation

The latest stable release (and required dependencies) can be installed from pip.

pip install macrocorr

Usage

  • For all macroeconomic indicators and all major categories, check out CATALOG.
  • For more detailed uses of the functions, check out FUNCTIONS.
  • For a step-by-step example use-case, check out example_basic.ipynb.

Quick Start

  1. Import “correlator” from Macrocorr
import macrocorr as mcrr
  1. Create a correlator with the data you want to analyze
my_correlator= correlator(date=my_data['Date'].values, data_x=my_data['Price'].values)
# data_x should be an one-dimensional array of numerical value
# make sure the values from date and data_x are matched
  1. Analyze and compare the correlation with the macroeconomic indicators from a category
my_correlator.analyze_Correlation(category='population', country='USA', top_num=3)
# print the top 3 most correlated indicators from the category (='population') 
# with their respective Pearson's coefficient and p-value
# plot the graph with both the input data and data of the most correlated indicator
  1. Analyze the correlation with one specific indicator
my_correlator.get_Correlation(y_name="Population, total", graph=True)
# print the Pearson's coefficient and p-value of the indicator (='Population, total') 
# plot the graph with both the input data and data of the indicator

Contributing

Development takes place on Github

Pull requests are welcome. Feel free to add more macroeconomic indicators or analysis methods.

For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

macrocorr-0.0.11-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file macrocorr-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: macrocorr-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for macrocorr-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 369344acf5786424a8eef7323d3e686bdcf2810559c58eb5f182e53c6b1db394
MD5 c8448f183bbd8c48be126605a84c5c50
BLAKE2b-256 5d20cd5204783fe11e2bf72c801a13a97b376a0621f5fd5d9b591749246929be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page