A package for calculate and draw copula density
Project description
Package info
Package name: copuladensity-pkg
Version: 0.0.3
Author: Shanshan Wang
Description: this package is used to calcualte and draw copula density of two correlated time series.
Python requires version >=3.6
Install
pip install copuladensity-pkg
Uninstall
pip uninstall copuladensity-pkg
How to use
from copula_package import copula_density
Functions
- copula_density.sampling_two_corr_time_series(mean,cov,n)
function: sample two correlated time series
mean: a list of two mean values for two time series, respectively, e.g., mean = (1, 2)
cov: a 2-d array of diagonal covariances between two time series, e.g., cov = [[1, 1], [1, 2]]
n: the length of each time series
return x, y, z
x: a list of time series
y: a list of time series
z: a pandas dataframe for x and y
- copula_density.draw_histogram(x,n_bins,label_x)
function: draw historgram of a time series, where the hight of histogram shows the probability density
x: a list of time series
n_bins: the number of bins in the histogram
label_x: a string for the label of x axis in the figure
return: none
- copula_density.draw_joint_distribution(z,label_x,label_y)
function: draw joint distribution of two time series z: a pandas dataframe with two columns, where each column contains a time series
label_x: a string for the label of x axis in the figure
label_y: a string for the label of y axis in the figure
return: none
- copula_density.qrank_data(x)
function: calculate the quantile of ranking data x
x: a list of time series
return: qx
qx: a list of quantiles
- copula_density.calc_copula_density(qx,qy,nx,ny)
function: calculate copula density of two time series
qx: a list of quantiles
qy: a list of quantiles
nx: the number of bins for qx
nx: the number of bins for qy
return: cop_den
cop_den: a $nx\times ny$ 2-dimentional array of copula densities
- copula_density.draw_heatmap(matrix,label_qx,label_qy)
function: draw heatmap for copula densities
matrix: 2-dimensional array of copula densities
label_x: a string for the label of x axis in the figure
label_y: a string for the label of y axis in the figure
return: none
- copula_density.draw_surface(matrix,label_qx,label_qy)
function: draw surface for copula densities
matrix: 2-dimensional array of copula densities
label_x: a string for the label of x axis in the figure
label_y: a string for the label of y axis in the figure
return: none
- copula_density.draw_bar3d(matrix,label_qx,label_qy)
function: draw 3-dimensional bars for copula densities
matrix: 2-dimensional array of copula densities
label_x: a string for the label of x axis in the figure
label_y: a string for the label of y axis in the figure
return: none
An example
from copula_package import copula_density
# sampling two time series
mean = (1, 2)
cov = [[1, 1], [1, 2]]
n=10000
x,y,z=copula_density.sampling_two_corr_time_series(mean,cov,n)
# draw histogram and joint histogram of time series
n_bins=50
label_x='x'
label_y='y'
copula_density.draw_histogram(x,n_bins,label_x)
copula_density.draw_joint_distribution(z,label_x,label_y)
# calculate quantiles
qx=copula_density.qrank_data(x)
qy=copula_density.qrank_data(y)
# calcualte copula density
nx=20
ny=20
cop_den=copula_density.calc_copula_density(qx,qy,nx,ny)
# draw copula density in three ways
label_qx='Quantile(x)'
label_qy='Quantitle(y)'
copula_density.draw_heatmap(cop_den,label_qx,label_qy)
copula_density.draw_surface(cop_den,label_qx,label_qy)
copula_density.draw_bar3d(cop_den,label_qx,label_qy)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file copuladensity-pkg-0.0.3.tar.gz.
File metadata
- Download URL: copuladensity-pkg-0.0.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ea9bdf914d0c138ec706120aad026629e4020f0147ab4d357a2ce31cf9c3dc3
|
|
| MD5 |
14c10ee3f5a0e3c491a454663ee0435d
|
|
| BLAKE2b-256 |
93b24580ec196d351cdd208ca45fe8559ba6a8ea857bcd7a0e9d299cd693cfef
|
File details
Details for the file copuladensity_pkg-0.0.3-py3-none-any.whl.
File metadata
- Download URL: copuladensity_pkg-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b082e6c84f813117b3eacebb33a8b867a0dd56e832448b26ffe6ab985c5d148
|
|
| MD5 |
5df533b2584a704db8dc10dbbefc1683
|
|
| BLAKE2b-256 |
0c1afc32abece6ded8d40239287b5929b2d6b4d00a33ab446c190155dbf31606
|