<<

MCMC Methods for Bayesian Mixtures of Copulas

Ricardo Silva Robert B. Gramacy Department of Statistical Science Statistical Laboratory University College London University of Cambridge [email protected] [email protected]

Abstract a modular parameterization of distributions and den- sities (Nelsen, 2007): the choice of families for the uni- Applications of copula models have been in- variate marginals is arbitrary, and a copula function creasing in number in recent years. This class defines the full joint for a fixed choice of marginals. of models provides a modular parameteriza- This is particularly attractive in domains where good tion of joint distributions: the specification of models for individual objects are known and well- the marginal distributions is parameterized motivated, but a dependency model for such objects separately from the dependence structure of less so. A popular example is financial modeling: the joint, a convenient way of encoding a while models such as heavy-tailed t-distributions pro- model for domains such as finance. Some re- vide a good fit to individual stocks, it is less clear cent advances on how to specify copulas for how to model the joint distribution of stock prices. arbitrary dimensions have been proposed, by The copula parameterization allows for different mod- of mixtures of decomposable graphi- els while conveniently preserving a choice of univariate cal models. This paper introduces a Bayesian marginals that are well-suited to the problem. Nelsen approach for dealing with mixtures of copu- (2007), Joe (1997), Nicoloutsopoulos (2005) and Kir- las which, due to the lack of prior conjugacy, shner (2007) describe the theory and applications. raise computational challenges. We motivate and present families of Monte Defining a copula function for distributions with three Carlo (MCMC) proposals that exploit the or more variables is difficult. However, through mix- particular structure of mixtures of copulas. tures of tree-structured distributions, one can extend Different algorithms are evaluated according bivariate copulas to problems of arbitrary dimension. to their mixing properties, and an application Kirshner (2007) describes the tree-copula formulation in financial forecasting with missing data il- and a particular setup for finite mixtures, as well as lustrates the usefulness of the methodology. a maximum likelihood approach for learning. In this paper, the challenge is how to perform Bayesian infer- ence. Copula models are not in the 1 CONTRIBUTION and we will have to deal with non- dis- tributions. In order to provide a self-contained presen- We present and evaluate new approaches for comput- tation, Section 2 contains a brief description of copula ing posterior distributions of mixtures of copula mod- models. Our is described in Section 3. els. The goal is to provide new tools for density estima- The bulk of our contribution is contained in Section 4, tion in multivariate analysis where copula models are where we detail different MCMC proposals suited for deemed appropriate. This requires efficient Markov this class of models. Experiments are described in Sec- chain Monte Carlo (MCMC) methods that exploit the tion 5. The final application concerns an illustration particularities of copula models, and such algorithms of stock market predictions under missing data. are evaluated according to their mixing properties. The copula approach for multivariate analysis provides 2 REVIEW OF COPULA MODELS

Appearing in Proceedings of the 12th International Confe- A bivariate copula function C(u, v) is a cumulative dis- rence on Artificial Intelligence and (AISTATS) tribution function (CDF) over the interval [0, 1]×[0, 1] 2009, Clearwater Beach, Florida, USA. Volume 5 of JMLR: with uniform marginals (Nelsen, 2007). If the density W&CP 5. Copyright 2009 by the authors. function exists, we denote it by c(u, v). This concept is

512 MCMC Methods for Bayesian Mixtures of Copulas particularly useful for parameterizing bivariate distri- drawback is that the tree imposes many conditional butions. If Fi(·) and Fj (·) are the marginal CDFs for independence constraints that might be undesirable. Y and Y , the joint CDF F (Y , Y ) is fully determined i j i j Much more flexibility can be achieved by using mix- by the triplet tures of trees. Let Y(i) denote a particular data point. The model of Kirshner is defined by {Fi(·), Fj (·), C(ai(·),aj (·))},

(i) (i) (i) −1 Y | T , Θ ∼ p( · | T , Θ) (3) where ai(·) ≡ Fi (·). Changing the copula function (i) will define a different joint while keeping the same T ∼ pT ( · | ΘT ) marginals. Changing the marginals but keeping the copula fixed will result in a different joint: in this case, where Θ consists of parameters for all marginals and however, any measure of association ρ(Yi, Yj ) that is copula parameters for each pair of variables. As in invariant with respect to strictly monotonic transfor- Equation (2), only parameters associated with a par- mations (e.g., taking logarithms) will remain the same. ticular edge are used in the definition of p(·| T (i), Θ). Conversely, any continuous CDF will imply an unique Trees are hidden variables, with a distribution param- copula function (a fundamental result in multivariate eterized by ΘT . Without loss of generality, the trees analysis derived in Sklar’s theorem; see, e.g., page 18 can always be connected graphs. The absence of an of Nelsen, 2007). An example is the density of the edge Yu − Yv is equivalent to choosing the indepen- Gaussian copula function with parameter ρ: dence copula C(u, v) = uv as the respective copula function. 2 2 − 1 − u + v 2ρuv Φρ(u, v)= exp 2 (1) 2π 1 − ρ2 2(1 − ρ ) In what follows, we describe a Bayesian approach   and show how efficient MCMC proposals can be con- p structed. To the best of our knowledge, this is the first This copula is the one implied by the Gaussian CDF, Bayesian approach to this problem. and can be used to construct non-Gaussian distribu- tions if applied with non-Gaussian marginal CDFs. Pitt et al. (2006) describe a Bayesian approach for 3 MODEL AND PRIORS Gaussian copula models with applications in finance and health care. Nicoloutsopoulos (2005) discusses a Kirshner (2007) also introduced a maximum likelihood variety of problems that have natural representations estimator (MLE) for mixtures of tree-copulas. In his in terms of copulas and univariate marginals. model, the set of all tree models is parameterized by a single matrix of O(d2) parameters: each pair of vari- 2.1 Tree-Copulas and Mixtures ables is associated with a particular copula function independently of the trees. As such, different trees It is, however, very hard to construct multivariate cop- will share the same parameters corresponding to the ulas for three or more random variables (Nelsen, 2007), common edges. Both the matrix and the mixture pro- the Gaussian being an exception. Kirshner (2007) uses portions are learned by finding their MLE. This choice a simple but clever trick to define copulas of arbi- of parameterization is motivated by the fact one can trary dimensionality d by assuming the distribution is obtain simple expressions for updating the parame- Markov with respect to a tree T with edge set E(T ). ter estimates in a iterative scheme (at a cost of O(d3) Assume that the data is continuous and the joint den- per iteration), which is an adaptation of the setup de- sity p(Y) exists. The copula-parameterized density scribed by Meilˇaand Jaakkola (2006). Although one function is given by can also motivate the above parameterization of the

d tree mixture by claiming it to be conjugate to the density of Y given a tree, the approach of Kirshner p(Y|T , Θ) = fv(Yv | Λv) cT (a) (2) (2007) is not Bayesian. It also assumes there is no "v=1 # Y missing data. cT (a) ≡ cuv(au(Yu),av(Yv) | Θuv), {u,v}∈E(T ) In the Bayesian case, there is little motivation to use Y the constraints of Meilˇaand Jaakkola (2006), which where Λv is a set of parameters for the marginal fv(·) requires massive parameter sharing across trees. The and Θuv is a set of parameters for the copula density reason is that the parameters cannot be integrated out function cuv(·, ·). The result is interesting due to the analytically, and so we will need to resort to MCMC fact that the set {cuv(·, ·)} can be an arbitrary set of methods anyways. Each tree-copula in our proposed bivariate copula densities, and cT (a) is still guaran- mixture has a different set of parameters, allowing the teed to be a valid multivariate copula density. The potential number of mixture components to be infi-

513 Silva, Gramacy nite.1 (i) Our proposed model is related to—but different πk z(i) Y from—the mixture of trees approach of Kirshner and N Smyth (2007), which is learned through a Bayesian ap- proach but which has a different set of marginal param- eters per mixture component. This is not suitable for θk Λ problems motivated by the modular nature of copula parameterizations. Moreover, the models of Kirshner oo and Smyth (2007) are restricted to discrete distribu- tions and conjugate priors. Figure 1: A plate for the generation of N data points Y. Indicators z are hidden. The fig- 3.1 Model Details ure stresses that the mixture model is over the copula parameter Θ, which does not include the marginal pa- The basic prior for our model follows the standard rameterization Λ (which could be itself another Dirich- (DP) mixture formulation (Neal, let process mixture). 2000), except that only trees and copula parameters vary between different mixture components. Each tree will have the same univariate marginals, so that all dent of Y(i) given the latent tree T (i). Unlike Meilˇa univariate marginals are fully defined independently and Jaakkola (2006), parameters are not re-used across of the mixture of trees. If non-parametric marginals trees. Unlike Kirshner and Smyth (2007), parameters or copulas are desirable, they can be parameterized are not a priori exchangeable between pairs of vari- accordingly (Nicoloutsopoulos, 2005), but once again ables (copula families might differ for different pairs) disentangled from the prior over trees. and hence can not be interpreted as coming from the Define the finite mixture model with K components same array of dimensionality O(d). as follows: It is sensible to question the need for such param- (i) (i) eters. In transdimensional Monte Carlo approaches Y | z , [T ], Λ, [Θ] ∼ p( · | Tzi , Λ, Θzi ) (also known as reversible jump MCMC, Green, 1995), Λ ∼ p ( · ) Λ parameters are created and destroyed as needed by Θz ∼ pΘ( · ) (4) moves through model space. However, the Dirichlet (i) z | π ∼ Discrete( · | π1,...,πK ) process mixture requires a common base measure for all component mixtures, and as such the parameter T ∼ T (·) z 0 space for two different tree components has to be the π ∼ Dirichlet( · | α/K,...,α/K) same. Given the flexibility and the many successful where [T ] is the set of all possible trees indexed by z; applications of DP mixtures, we favor this approach [Θ] is the set of all copula parameters, a copula for each over the finite mixture models approach. pair of variables; Λ is the set of univariate marginal As a matter of fact, the likelihood function for a par- parameters. The functions on the right-hand side are ticular tree component can be written so that it is a respective density functions or mass functions defined (trivial) function of all O(d2) copula parameters. Let in the next sections. E be the symmetric adjacency matrix representation We will assume that the joint prior for the trees, of an undirected tree T , and let E be the space of ma- marginal and copula parameters is fully factorized, and trices encoding spanning trees. The likelihood of point denote the marginal priors for Λu and Θz ≡ {Θuv;z} Y is therefore described by Equation (2) with cT (a) by pΛ(Λu) and pΘ(Θuv;z), respectively. given by

The Dirichlet process mixture over trees arises in the uv c (a)= c (a (Y ),a (Y ))e (5) limit, as K → ∞. A diagram for the model, in the T uv u u v v u,v;1≤u

3.2 Remarks on Transdimensional Methods where euv ∈{0, 1} is the respective element of E. The base measure of the DP mixture is defined over the From the model specification, it is clear that there distribution of matrices in E and the common distri- will be copula parameters Θuv;z(i) that are indepen- bution of copula parameters. We have to guarantee 1In the Bayesian setup, copula parameters for a given that changes in E result in a valid model, and as such pair of variables still naturally share a common prior. This the (fixed) space of parameters must account for all provides a softer version of parameter sharing. possible combinations of edges.

514 MCMC Methods for Bayesian Mixtures of Copulas

The fact that, for a fixed tree, some parameters play be used in a MH scheme. a trivial role in the likelihood function will have impli- The Simple proposal: the simplest tree proposal cations in the MCMC approaches, as we will see. consists of choosing an edge Yu − Yv uniformly at ran- dom and moving it uniformly at random to any legal 4 FAMILIES OF PROPOSALS place Ym − Yn that will result in a new spanning tree. Although we are still keeping the same sampled pa- We need to sample parameters Θz ∪ Λ ∪ π, trees Tz and latent variables z. Sampling z given the other el- rameters, this local change makes only a small modifi- cation to the tree model. Parameters associated with ements can be done using Algorithm 8 of Neal (2000) the unchanged edges remain in the likelihood function. and we will not discuss it further. In what follows However, it is fast and easy to implement. we describe the proposals to be used in a Metropolis- Hastings (MH) scheme when sampling parameters and The Treeangle proposal: the Simple proposal has trees. The non-standard step consists of sampling two shortcomings. In the choice of edge, the result- trees given all other elements, which we now describe ing path connecting Yu and Yv can be very large, and in full detail. their association will typically be much smaller than the one in the current tree model. The chances of re- 4.1 Tree Proposals jection for this case can be higher than in moves that do not propose a great excursion from the current as- We cannot sample from the posterior marginal of T sociations implied by the tree. Moreover, it will be directly, but sampling becomes doable after condition- sensible to choose a new set of parameter values in ing on the copula parameters, i.e., by sampling from tandem with the new edge. An arbitrary edge move the distribution TΘz (Tz) ≡ P (Tz | Θz). As a matter might complicate the choice of new sensible values for of fact, this distribution assumes the form the parameters of the added edge Ym − Yn. 1 TΘ(T )= βuv. (6) To increase acceptance, we favor an approach that ZT Θ {u,v}∈E(T ) makes more localized changes and proposes new pa- Y rameter values simultaneously. For a fixed tree T , de- ? It is well-known that there are exact and randomized fine a proposal q(T | T ) by the following algorithm: algorithms for sampling from such a distribution, and this has been successfully applied in other MCMC con- 1. for each Yi − Yj in E(T ), let wij = (#ni − 1) + texts (Kirshner and Smyth, 2007). However, in our (#nj − 1), where #ni is the number of neighbors case we face the challenge that the weights βuv are not of Yi in T . Let WT = {i,j}∈E(T ) wij obtained after marginalizing parameters, as in Kirsh- P ner and Smyth (2007), but conditioned on parameters 2. choose an edge Yu − Yv from T with probability sampled from a MCMC iteration. Importantly, most wuv/WT of such parameters were not associated with any data point in the previous iteration. Sampling from (6) has 3. choose a neighbor Yt of {Yu, Yv} in T\{Yu, Yv} unwanted consequences: the previously detached pa- uniformly at random rameters were sampled from the prior (as implied by ? (5)), and therefore are likely to be bad choices for mod- 4. return a tree T that results from removing from eling the data points in that particular cluster. T the edge Yu − Yv and adding the edge Y? − Yt, where Y? = Yu if Yv and Yt are adjacent in T , and As a matter of fact, a pilot implementation revealed otherwise Y? = Yv. that the randomized algorithms for sampling from (6) are useless for all practical purposes: most copula den- We call such a tree modification a treeangular move, sity functions are essentially zero, which implies the because it changes a “treeangle” Y −Y −Y in T into algorithm will not converge in any reasonable amount i j k a new subpath Y − Y − Y . The choice of treeangle of time. The exact algorithm is also problematic: not j i k is uniform, since q(T ?|T ) ∝ 1 for all T ?. This move only might the mixing of the chain be bad due to a de- always results in a spanning tree, as illustrated by Fig- pendence on a large uninformative set of parameters, ure 2(a)-(b), and can be computed at a cost of O(d). but also due to the extreme variability of the copula It is possible to traverse the whole space of spanning densities which translate into numerical instabilities. trees with sequences of treeangular moves. For problems with conjugate priors or small dimen- sional ones, the exact algorithm is helpful. However, Proposition 1 Let T and T ? be two spanning trees. in general we will need a different approach. Then there is a sequence of treeangular moves that We now define three different tree proposals that can transforms T into T ?.

515 Silva, Gramacy

T Tv Tv v Tv T2 Y T v Yv Yv 1 Y2 T T Yv t t Y1 Yt Yt

Yu Yu Yu Y3 T3

Y Tu Tu Yu 4 T4 (a) (b) (c) (d)

Figure 2: In the pictures above, circles represent vertices and squares represent subtrees. Dashed edges represent the possibility that a circled vertex is adjacent to several vertices in the subtree. The treeangular move that replaces the edge Yu − Yv in (a) with edge Yu − Yt always results in another spanning tree, as illustrated in (b). To obtain an tree in which Yu has a single neighbor Yv, as illustrated by (c), one can start from an arbitrary tree such as (d), and sequentially “move” Yu towards Yv in the (unique) path between them using treeangular moves. After connecting Yu with Yv, other neighbors of Yu can be eliminated also by treeangular moves.

Proof: Every spanning tree has at least one vertex For the rest of the paper, consider the case where all with exactly one neighbor. Let Yu be such a vertex in bivariate copulas that define the tree-copulas are one- ? T and Yv its respective neighbor, as in Figure 2(c). If parameter functions. This includes a large number Yu and Yv are not neighbors in T , there is an unique of families of copulas, including the Gaussian. The ? path Yu − Yp(1) − Yp(2) −···− Yv in T (where it might following is a template for proposals for a new θut to be possible that Yp(2) = Yv). Since Yu and Yp(2) are be sampled along a treeangle move Yu − Yv − Yt → not adjacent, exchange edge Yu − Yp(1) with Yu − Yp(2) Yu − Yt − Yv: using the local triangular move. This can be propa- 1. calculate the rank correlation ρ corresponding gated through the path until Yu and Yv are adjacent, uv as illustrated by Figure 2(d). to θuv

If Yu has other neighbors, they can be passed to Yv 2. calculate the rank correlation ρut corresponding again with the same move until Yu has Yv as its single to the copula function implied by Yu − Yv − Yt neighbor. The edge Yu −Yv exists in both trees, and it 0 3. find a ρut that trades-off the following: is not part of any path but the one-edge path contain- (a) ρ0 is “close” to ρ ing Y − Y . It is then possible to ignore the existence ut ut u v (b) ρ is “close” to the implied rank correlation of this edge in both trees and repeat the process until uv ?  of Yu and Yv as given by the path Yu −Yt −Yv T = T . 0 and parameters θtv and θ(ρut) ? Given a proposed tree T with new edge Yu − Yt, we 0 0 ? 4. calculate θut from ρut also sample a new parameter vector Θut for the corre- ? sponding tree. Ideally, the new value should be based 5. propose θut from a distribution parameterized by 0 on the current implied copula that results from the θut distribution based on T , i.e., the copula that corre- sponds to the joint of {Yu, Yt} as encoded by the cur- A possible measure of distance between ranks is the rent {Θ, T}. Euclidean distance, and the sum of the individual dis- tances in 3.(a) and 3.(b) above defines a simple trade- Even though the dimensionality of our model is fixed, off to be minimized. In general, the transformation we can follow the common practice in the literature of into rank correlations defines a copula-agnostic com- transdimensional Monte Carlo methods (Green, 1995): mon scale to ease the choice of distance measure. In parameterize the proposal distribution of the new pa- practice, mapping between parameters and rank corre- rameter set Θ? according to functionals of the implied 0 ut lations, and finding the corresponding ρut, will require copula. In particular, in copula functions with one pa- a numerical procedure. However, since we are dealing ? rameter only (θut), there is usually a one-to-one cor- with a density over three variables only, pre-computed ? respondence between θut and a canonical measure of tabulated solutions can be feasibly provided as rea- association between Yu and Yv. This includes, for in- sonable approximations. For instance, Joe (1997) pro- stance, Kendall’s tau and Spearman’s rank correlation vides several tables for approximately mapping param- ρ (e.g., see the tables in Chapter 5 of Joe, 1997). eters to rank correlations (the approximation does not

516 MCMC Methods for Bayesian Mixtures of Copulas affect the correctness of the sampler, since the MH portional to the evaluated marginal likelihoods. One- procedure will provide detailed balance as long as we parameter copulas with fully factorized priors require provide the proposal probabilities according to the ap- only the (numerical) computation of three unidimen- proximation). Furthermore, one important case can sional integrals: those corresponding to the marginal be solved analytically: when all bivariate copulas are likelihoods of Yu − Yt, Yu − Yv and Yt − Yv. This can Gaussian. An example in the Gaussian case will help be efficiently done by quadrature methods. Once the to clarify the procedure. new subtree structure is chosen, we propose new pa- rameters using the same proposal of Treeangle and Example (Gaussian copulas): If each copula in evaluate the joint (tree, parameters) proposal using the path Y − Y − Y is Gaussian with parameters u v t the same MH update (8), but with a different tree pro- {θ ,θ }, respectively, it is known that the implied uv vt posal q0(T ? | T ). Since we are combining a quadrature copula for {Y , Y } is also Gaussian with parameter z z u t method with MCMC updates, we call this the Hybrid θ θ (for simplicity, in this example we are bypass- uv vt method. ing the rank correlation transformation and working directly in the parameter space). We can then choose The overhead of solving integrals numerically is 0 our θut as the one that minimizes strongly amortized by increasing sample sizes and di- mensionality. Since each point belongs to a single clus- 0 2 0 2 (θut − θuvθvt) + (θuv − θutθvt) (7) ter at each MCMC iteration, a single pass through the data is performed for all trees in all clusters in any where the first term in the sum corresponds to the given iteration. Moreover, the cost does not increase distance in 3.(a) and, the second term, to the dis- with the dimensionality of the data. Meanwhile, sev- tance in 3.(b) (with the sum of both defining the trade- eral passes will be necessary in order to update the 0 2 off). The solution is given by θut =2θuvθvt/(1 + θvt). marginal parameters at a O(d) cost. ? We then sample θut from a uniform distribution in 0 0 (max(−1,θut − w), min(1,θut + w)) for a user-specified 4.2 Sampling Parameters parameter w (recall that the Gaussian copula param- eter lies in [−1, 1]).  Sampling given marginal or copula parameters by fix- ing all other parameters can be done by several stan- Let q (θ? |T ) represent the parameter proposal uvt ut;z z dard approaches, such as MH or slice sampling (Neal, within cluster z as determined by the choice of treean- 2003). It is relevant to discuss the required factors gle move Y − Y − Y (where, of course, we are condi- u v t used in evaluating a MH proposal for the marginal pa- tioning on the other parameters, data, and latent vari- rameters Λ of a given variable Y . Let D denote ables). We also need to define a proposal for θ? in u u uv uv the set of datapoints associated with trees where the order for the move to be reversible. One possibility is edge Y − Y exists. When proposing new marginal to define a proposal based on the sampled value of θ? u v ut parameters Λ? , let the respective ratio R (proposals using an analog mechanism. However, notice that this u u omitted) be: parameter will not affect the likelihood of the new tree model. As such, we suggest taking the proposal simply d (i) ? ? f(Yu | Λ ) p (Λ ) ? ? ? u Λ u be the prior, i.e., quvt(θuv;z | θut;z, Tz) ≡ pΘ(θuv). Ru ≡ (i) × (9) p (Λu) "i=1 f(Yu | Λu) # Λ Let Dz be the subset of the data currently assigned to Y ? (i) (i) cluster z. To summarize, the acceptance probability cuv(a (Yu ),a(Yv )) × of the coupled tree-parameter proposal is given by the   (i) (i)  v6=u Y(i) cuv(a(Yu ),a(Yv )) min{1, R}, where Y Y∈Duv    For notational simplicity, we also omitted the depen- (i) (i) ? ? dency of cuv(·, ·) on Θuv;z. This clarifies the comment cut(a(Yu ),a(Yt )|θut;z) q(Tz | Tz ) R= (i) (i) ? (8) made at the end of the previous section: when a new  q(T | Tz) Y(i) cuv(a(Yu ),a(Yv )|θuv;z) z ? Y∈Dz Λu is accepted, we will still need to make a new (possi-  ? ? ?  ? bly partial) pass through the dataset when proposing pΘ(θut;z)pΘ(θuv;z) T0(T ) quvt(θut;z,θuv;z |Tz ) × ? ? ? Λv for any Yv connected to Yu in some tree. This fol- pΘ(θut;z)pΘ(θuv;z) T0(T ) quvt(θut;z,θuv;z |Tz) lows from the fact that all a(Yu(i)) have been modified, since a(Y (i)) ≡ F −1(Y (i)), a function of Λ . The Hybrid proposal: finally, we suggest a more u u u computer-intensive variation of the Treeangle pro- Other remarks: Strictly speaking, it seems we need posal. Given a treeangle Yu − Yv − Yt, calculate to sample all copula parameters for a particular cluster the marginal likelihood of the copula densities of z at each iteration of parameter sampling. However, Yu − Yt − Yv and Yv − Yu − Yt and choose between only O(d) parameters affect the likelihood function in one of the two subtree structures with weights pro- any given cluster, as discussed. It seems wasteful to

517 Silva, Gramacy sample the remaining parameters for applications that tic to be traced. We calculate the effective sample size do not need them (e.g., prediction problems). It is in- (ESS) (Kass et al., 1998) of each independent entry in deed the case that we never need to explicitly sample the average matrix (a total of d(d − 1)/2 entries), and O(d2) parameters. Since the parameters not associ- adjust it by dividing by the total sampling time of the ated with any tree are by definition sampled from the algorithm. For each entry, we then calculate the ra- prior, no history of such parameters is necessary when tios of the adjusted ESS for Hybrid (H) with respect proposing a new MH move. Instead, we can sample the to each of the other algorithms ((S)imple, (T)reengle “old” parameter Θut on-demand, by sampling it from and (E)xact) and report the average over the matrix the prior when a new edge Yu −Yt has to be evaluated, entries in Table 1. We also report the non-adjusted ra- as if it was sampled in the previous iteration. Notice tios (i.e., without correcting for the computing time) to that an exact tree sampler, which requires the evalua- give a better idea of the improvements of the Hybrid tion of (6), cannot take advantage of this shortcut and algorithm, since the time difference between the algo- will require sampling all parameters. rithms tends to zero for larger datasets and non-fixed marginals. These are reported as the H/*n columns. 5 EXPERIMENTS We also report the acceptance rate for the tree moves (Acc*) (we omit the Exact algorithm, since it is not We evaluate how the different proposals compare in comparable to the others). Section 5.1 and illustrate a simple application of the For most of the experiments, there is a clear advan- MCMC methodology in 5.2. For simplicity, we define tage of Treeangle and Hybrid over the others, and T to be the uniform distribution over spanning trees 0 an advantage of Hybrid over Treeangle3. This is so that we can efficiently sample from this distribution, reflected both by measuring the ESS of the average la- as required by Algorithm 8 of Neal (2000). A stepping- tent copula correlation matrix, and through the accep- out slice sampler (Neal, 2003) is used to sample copula tance rate of different trees. It is also clear that with parameters. MH with Gaussian or uniform proposals the default sampling parameters, some difficulties arise is used to sample marginals. for all samplers with cloud as the acceptance rate for the trees is overall low. This can be partially explained 5.1 Algorithm Comparison by plotting the data: it can be seen that there are We use Gaussian bivariate copulas as the base copula, strongly non-linear pairwise trends that might create with uniform priors in [-1, 1] for the copula param- difficulties for the mixture of Gaussian copulas. Nev- eters. In the first experiment, we compare Simple, ertheless, it is clear that the proposed samplers show Treeangle, Hybrid and an exact algorithm (Ex- consistent improvement over standard approaches. act) for sampling from (6) without changing param- eters2. Marginals are set to the empirical CDF and 5.2 Missing Data Example fixed throughout the whole procedure to better evalu- ate the differences between the copula samplers. In order to show a simple application that cannot be performed by analytically integrating trees even un- We chose nine datasets from the UCI Repository der conjugate conditions (Meilˇaand Jaakkola, 2006), (Blake and Merz, 1998). Discrete variables were re- we apply the Bayesian copula mixture to a problem moved (defined to be variables that take three or fewer with missing data. In stock market data analysis, it is distinct values in the training set). A burn-in period common to have missing measurements at any partic- of 1,000 points is followed by 50,000 samples which ular time point − partially because some of the stocks we used in the comparison. We summarize the results did not exist at that time. We used the monthly re- in Table 1. We choose the copula correlation matrix turns data from NYSE and AMEX from 1968–1998 implicitly encoded by the tree-copulas, averaged over described by Gramacy et al. (2008). As a test set, we training points, as a cluster label-independent statis- removed the monthly returns for the stocks in the final 2In each step, if we could not perform the required ma- year. Tree-copulas with Gaussian components are used trix inversions due to numerical instabilities, we would ap- along with t-marginals under Jeffrey’s prior. We ran ply the Simple procedure. The proposal for the copula 10 different trials by randomly selecting 10 stocks with parameters is the one described in the Example of Section no missing data (from a total of over 1200), plus an- 4.1 with w = 0.15. We initialize the clusters with 10 parti- other 20 stocks with 10–100 missing entries. We com- tions by uniform sampling, and then do k-means as follows: fit the maximum likelihood tree for each cluster and com- pare the full MCMC methodology where missing data pute the similarity of each point to each cluster using its is sampled using a standard MH procedure, against an log-likelihood; points are reassigned to the most similar cluster and the process iterated. Parameters and trees are 3The exceptions are the datasets glass and yeast. The initialized by their MLEs. The DP α is difficulty in glass might be due to several variables having given a Gamma(0.1, 1) prior. the majority of their values at zero.

518 MCMC Methods for Bayesian Mixtures of Copulas

Table 1: Comparison of the ratio of the average effective sample sizes for the different algorithms (H, S, T, E) in 9 different datasets, as explained in the text. In the table, d refers to the number of variables and N to the sample size. The respective proportion of accepted trees is given as the last three columns. Dataset d N H/S H/T H/E T/S T/E H/Sn H/Tn H/En AccS AccT AccH cloud 10 1024 2.35 1.06 4.27 4.30 8.01 3.17 1.36 5.50 0.010 0.036 0.031 concrete 9 1030 3.23 1.98 1.20 1.83 0.74 4.25 2.58 1.78 0.066 0.102 0.137 ecoli 5 336 1.62 1.43 1.03 1.20 0.82 3.03 2.70 1.84 0.168 0.204 0.245 fire 7 517 1.34 1.15 2.17 1.14 2.15 1.79 1.58 3.07 0.147 0.178 0.218 glass 8 214 0.81 0.84 0.89 1.03 1.19 1.09 1.14 1.14 0.112 0.172 0.214 seg 16 205 9.16 1.13 8.02 9.17 8.55 10.5 1.36 8.23 0.047 0.088 0.141 vowel 10 990 1.17 1.84 1.23 1.03 0.95 1.71 2.42 1.98 0.070 0.091 0.141 wdbc 30 569 6.38 3.04 4.86 5.52 6.96 7.00 3.22 4.02 0.028 0.088 0.110 yeast 6 1484 0.94 0.67 1.18 1.40 1.77 1.48 1.08 1.80 0.208 0.262 0.315

analogue of the structure learning problem in general Table 2: Predictive log-likelihood for 10 trials with Markov random fields corresponds in our formalism to the financial data with two methods for missing data the problem of choosing which pairs should be given treatment (Sampled and Avg). the independence copula across trees. Trial Sampled Avg Trial Sampled Avg 1 -35.07 -35.47 6 -36.10 -35.57 Acknowledgements 2 -38.89 -39.49 7 -34.87 -35.38 The algorithm and code for the Exact method was kindly 3 -38.39 -40.15 8 -36.27 -36.55 provided by Sergey Kirshner. This work was supported by 4 -36.95 -37.27 9 -34.62 -34.61 EPSRC Grant #EP/D065704/1. 5 -35.80 -37.00 10 -36.12 -36.75 References off-the-shelf estimator that fills in the missing entries C. L. Blake and C. J. Merz. UCI repository of machine with the average of the observed entries. The Hy- learning databases, 1998. brid sampler is used in both cases. There is a total R. B. Gramacy, J. Lee, and R. Silva. On estimating covari- of 361 training points and 12 test points. The average ances between many assets with histories of highly vari- log-likelihood of the test set is calculated under both able length. Technical Report 0710.5837, arXiv, 2008. url: http://arxiv.org/abs/0710.5837. approaches and the result is shown in in Table 5.2. There is a consistent advantage to treating the missing P. Green. Reversible jump MCMC computation and Bayesian model determination. Biometrika, 82, 1995. data as part of the inference process that marginalizes latent variables. H. Joe. Multivariate Models and Dependencies Concepts. Chapman-Hall, 1997. R. Kass, B. Carlin, A. Gelman, and R. Neal. Markov chain 6 CONCLUSION Monte Carlo in practice: a roundtable discussion. The American Statistician, 52, 1998. We described how MCMC approaches for a Bayesian mixture of copulas can be efficiently designed. An un- S. Kirshner. Learning with tree-averaged densities and dis- tributions. NIPS, 2007. usual characteristic of this problem is the fact that ICML there will be parameters that, at any sampling stage, S. Kirshner and P. Smyth. Infinite mixtures of trees. , 2007. are independent of the data given other parameters M. Meilˇaand T. Jaakkola. Tractable Bayesian learning of (i.e., the tree adjacency matrices). Although this is tree belief networks. Statistics and Computing, 2006. related to transdimensional MCMC, we are not aware of other problems with this exact characteristic that R. Neal. Markov chain sampling methods for Dirichlet process mixture models. J. Comp. Graph. Stats., 9, 2000. have been tackled with MCMC methods. As future The Annals of Statistics work, we seek practical ways of imposing hierarchical R. Neal. Slice sampling. , 31, 2003. priors over parameters from different trees. develop R. Nelsen. An Introduction to Copulas. Springer, 2007. specialized approaches for special patterns of missing D. Nicoloutsopoulos. Parametric and Bayesian Non- data, such as monotone missingness patterns, for com- parametric Estimation of Copulas. PhD Thesis, Uni- versity College London, 2005. putational gains in higher dimensional problems. Per- forming model selection on the types of copulas used in M. Pitt, D. Chan, and R. Kohn. Efficient Bayes. inf. for Biometrika each edge is also an open challenge. In particular, an Gaussian copula regress. models. , 93, 2006.

519