Skip to content

SeoliKim/macrocorr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

macrocorr

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 package Macrocorr
import macrocorr as mcrr
  1. Create a correlator with the data you want to analyze
my_correlator= mcrr.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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published