Title: | Dirichlet-Based Polya Tree |
---|---|
Description: | Contains functions to perform copula estimation by the non-parametric Bayesian method, Dirichlet-based Polya Tree. See Ning (2018) <doi:10.1080/00949655.2017.1421194>. |
Authors: | Shaoyang Ning [aut, cre] |
Maintainer: | Shaoyang Ning <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.1 |
Built: | 2024-11-02 06:31:46 UTC |
Source: | CRAN |
dDPTreeRealize
returns
the value of density function of realized distribution from D-P tree at certain given point on copula space.
dDPTreeRealize(d, x)
dDPTreeRealize(d, x)
d |
A |
x |
An array of dimension n by 2. The points on copula space for density function evluation. Should be between 0 and 1. |
An array of length n. The values of PDF of the input D-P tree distribution evaluated at the input points.
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
dDPTreeRealize(DPTreePMeanDensity(DPTreePrior(m=2, z=1)),c(0.5,0.5))
dDPTreeRealize(DPTreePMeanDensity(DPTreePrior(m=2, z=1)),c(0.5,0.5))
DPTreeDensity
returns
the probablity measures in the finest sub-partitions of a realized distribution from D-P tree prior/posterior.
DPTreeDensity(Z)
DPTreeDensity(Z)
Z |
An array of dimension of |
A by
matrix. Normalized measures for all
by
sub-partititons on copula space
given by the realized distribution from D-P tree.
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
dp.rlz <- RealizeDPTree(DPTreePrior(m=2, z=1)) DPTreeDensity(dp.rlz)
dp.rlz <- RealizeDPTree(DPTreePrior(m=2, z=1)) DPTreeDensity(dp.rlz)
DPTreePMeanDensity
returns
the probablity measures in the finest sub-partitions of the posterior mean from D-P tree.
DPTreePMeanDensity(prior)
DPTreePMeanDensity(prior)
prior |
A list. D-P tree specification. Should be in same format as returned from |
A by
matrix. Normalized measures for all
by
sub-partititons on copula space
given by the posterior mean distribution from D-P tree.
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
DPTreePMeanDensity(DPTreePrior(m=2, z=1))
DPTreePMeanDensity(DPTreePrior(m=2, z=1))
DPTreePosterior
returns
the D-P tree posterior given input copula data.
DPTreePosterior(x, prior, w = 1)
DPTreePosterior(x, prior, w = 1)
x |
An array of length 2. Single copula data observation. Each element should be between 0 and 1. |
prior |
A list. Should be in same format as returned from |
w |
A positive number. Weight of data for posterior updating. Default 1. |
A list.
a |
An array containing the hyperparameters of D-P trees. |
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
nsim = 1 rho = 0.9 data1 <- MASS::mvrnorm(n=nsim, mu=rep(0, 2), Sigma=matrix(c(1, rho, rho, 1), 2, 2)) data2 <- stats::pnorm(data1) DPTreePosterior(x=data2, prior=DPTreePrior(m=4, z=1))
nsim = 1 rho = 0.9 data1 <- MASS::mvrnorm(n=nsim, mu=rep(0, 2), Sigma=matrix(c(1, rho, rho, 1), 2, 2)) data2 <- stats::pnorm(data1) DPTreePosterior(x=data2, prior=DPTreePrior(m=4, z=1))
DPTreePosteriorMulti
returns
the D-P tree posterior given input copula data.
DPTreePosteriorMulti(x, prior, w = 1)
DPTreePosteriorMulti(x, prior, w = 1)
x |
An array of dimension n by 2. Multiple copula data observations, with each row being a bivariate copula observation. All elements should be between 0 and 1. |
prior |
A list. Should be in same format as returned from |
w |
A positive number or an array of length n. Weight of data for posterior updating. Default 1. |
A list.
a |
An array containing the hyperparameters of D-P trees. |
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
nsim = 10 rho = 0.9 data1 <- MASS::mvrnorm(n=nsim, mu=rep(0, 2), Sigma=matrix(c(1, rho, rho, 1), 2, 2)) data2 <- stats::pnorm(data1) DPTreePosteriorMulti(x=data2, prior=DPTreePrior(m=4, z=1))
nsim = 10 rho = 0.9 data1 <- MASS::mvrnorm(n=nsim, mu=rep(0, 2), Sigma=matrix(c(1, rho, rho, 1), 2, 2)) data2 <- stats::pnorm(data1) DPTreePosteriorMulti(x=data2, prior=DPTreePrior(m=4, z=1))
DPTreePrior
returns
a standard D-P Tree prior based on specified hyperparameters.
DPTreePrior(m = 4, z = 1)
DPTreePrior(m = 4, z = 1)
m |
A positive integer. The finite approximation level for D-P tree. Default m=4. |
z |
A positive number. On i-th level, the hyperparameter for D-P tree prior is
|
A list.
a |
An array containing the hyperparameters of D-P trees. |
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
DPTreePrior(m=6, z=1)
DPTreePrior(m=6, z=1)
pDPTreeRealize
returns
the value of distribution function of realized distribution from D-P tree at certain given point on copula space.
pDPTreeRealize(d, x)
pDPTreeRealize(d, x)
d |
A |
x |
An array of dimension n by 2. The points on copula space for distribution function evluation. Should be between 0 and 1. |
An array of length n. The values of CDF of the input D-P tree distribution evaluated at the input points.
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
pDPTreeRealize(DPTreePMeanDensity(DPTreePrior(m=2, z=1)),c(0.5,0.5))
pDPTreeRealize(DPTreePMeanDensity(DPTreePrior(m=2, z=1)),c(0.5,0.5))
RealizeDPTree
returns
a realized (copula) distribtuion sampled from the input D-P Tree.
RealizeDPTree(prior)
RealizeDPTree(prior)
prior |
A list. Should be in same format as returned from |
An array of dimension by
by m. m is the approximation level.
Realized Z's for all partitions at each level.
Three dimensions reprensent two marginals, and the level respectively.
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
RealizeDPTree(DPTreePrior(m=2, z=1))
RealizeDPTree(DPTreePrior(m=2, z=1))
SampleDPTreeDensity
returns
a copula sample from a realized distribution from D-P tree.
SampleDPTreeDensity(nsam, d)
SampleDPTreeDensity(nsam, d)
nsam |
A positive integer. The sample size. |
d |
A |
An array of dimension nsam by 2. The values of PDF of the input D-P tree distribution evaluated at the input points.
Ning S, Shephard N (2018). “A nonparametric Bayesian approach to copula estimation.” Journal of Statistical Computation and Simulation, 88(6), 1081-1105. doi:10.1080/00949655.2017.1421194.
SampleDPTreeDensity(10, DPTreePMeanDensity(DPTreePrior(m=2, z=1)))
SampleDPTreeDensity(10, DPTreePMeanDensity(DPTreePrior(m=2, z=1)))