Package: copuladensity-pkg
Package infoPackage name: copuladensity-pkgVersion: 0.0.3Author: Shanshan WangDescription: this package is used to calcualte and draw copula density of two correlated time series.Python requiresversion >=3.6Installpip install copuladensity-pkgUninstallpip uninstall copuladensity-pkgHow to usefrom copula_package import copula_densityFunctionscopula_density.sampling_two_corr_time_series(mean,cov,n)function: sample two correlated time seriesmean: 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 seriesreturn x, y, zx: a list of time seriesy: a list of time seriesz: a pandas dataframe for x and ycopula_density.draw_histogram(x,n_bins,label_x)function: draw historgram of a time series, where the hight of histogram shows the probability densityx: a list of time seriesn_bins: the number of bins in the histogramlabel_x: a string for the label of x axis in the figurereturn: nonecopula_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 serieslabel_x: a string for the label of x axis in the figurelabel_y: a string for the label of y axis in the figurereturn: nonecopula_density.qrank_data(x)function: calculate the quantile of ranking data xx: a list of time seriesreturn: qxqx: a list of quantilescopula_density.calc_copula_density(qx,qy,nx,ny)function: calculate copula density of two time seriesqx: a list of quantilesqy: a list of quantilesnx: the number of bins for qxnx: the number of bins for qyreturn: cop_dencop_den: a $nx\times ny$ 2-dimentional array of copula densitiescopula_density.draw_heatmap(matrix,label_qx,label_qy)function: draw heatmap for copula densitiesmatrix: 2-dimensional array of copula densitieslabel_x: a string for the label of x axis in the figurelabel_y: a string for the label of y axis in the figurereturn: nonecopula_density.draw_surface(matrix,label_qx,label_qy)function: draw surface for copula densitiesmatrix: 2-dimensional array of copula densitieslabel_x: a string for the label of x axis in the figurelabel_y: a string for the label of y axis in the figurereturn: nonecopula_density.draw_bar3d(matrix,label_qx,label_qy)function: draw 3-dimensional bars for copula densitiesmatrix: 2-dimensional array of copula densitieslabel_x: a string for the label of x axis in the figurelabel_y: a string for the label of y axis in the figurereturn: noneAn examplefrom 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)