# Create a multivariate distribution with custom equation

I have the following distribution,

PDF[x] = $\begin{cases} -\frac{3 \left(x^2-40 x+200 \log (x)+300-200 \log (10)\right)}{2000} & 0<x<10 \\ 0 & \text{True} \end{cases}$

I would like to construct a 4-dimensional distribution with 4 parameters (x1, x2, x3, x4) in which all the parameters have this distribution, and in addition they are correlated. So its basically a custom multivariate distribution with a non identity covariance matrix.

Any ideas in how to construct this distribution?

The idea is later to evaluate the PDF of a certain point (a,b,c,d).

Edit

What I want to build is similar to MultiNormalDistribution but instead of a Normal distribution I would like to use this custom PDF with a certain covariance matrix.

• More specifics are needed and unless you're a Bayesian, parameters don't have distributions. Where is the parameter in the example given? Does each random variable have 4 parameters? What kind of dependence do you want for the 4 random variables? – JimB Aug 17 '16 at 19:08
• @JimBaldwin As you noted this comes from a Bayesian analysis. So each parameter in my Bayesian analysis is a random variable and they're correlated. All 4 random variables have the same positive covariance of 0.104. – BPinto Aug 17 '16 at 20:29
• OK. So X1, X2, X3, and X4 are parameters in a Bayesian framework with the same marginal distribution. You mention "correlation" and a "covariance matrix" but those items are features of a joint probability density function. It does not always follow that a specific non-identity covariance matrix will result in a unique multivariate density. The CopulaDistribution function will construct such a multivariate probability density function but there are zillions of possible functions with the desired marginals. How will you identify the one you want? – JimB Aug 17 '16 at 21:02
• @JimBaldwin I'm a little bit confused. What I want to build is similar to MultiNormalDistribution but instead of a Normal distribution I would like to use this custom PDF with a certain covariance matrix. – BPinto Aug 18 '16 at 12:58
• Please see the references given by @gwr given below. You'll also need to be more specific. The marginal distribution above has mean 5/4 and variance 85/48. And depending on the copula chosen, the conditional mean of say x2 given x1 is likely not linear so a correlation might not be easily or appropriately interpreted. If you're wedded to selecting a correlation or covariance first, then you'll need to solve for the associated copula parameter. Do you have a specific correlation or covariance in mind? – JimB Aug 18 '16 at 15:42

You'll probably want to use the CopulaDistribution function to generate a multivariate distribution with a set of specified marginal distributions.

With your example (where the parameters are all set) if we have all marginal distributions being identical, you can use the following:

(* Marginal distribution *)
d = ProbabilityDistribution[-3 (x^2 - 40 x + 200 Log[x] + 300 - 200 Log[10])/2000, {x, 0, 10}];

(* Construct multivariate distribution *)
multivariateD = CopulaDistribution[{"Clayton", 1}, {d, d, d, d}];

(* Evaluate the multivariate density function at an arbitrary point *)
N[PDF[multivariateD, {1, 2, 3, 7}]]
(* 0.0000390693 *)


Please see the documentation for CopulaDistribution to see what kinds of dependence structures you can impose.

Update

If you want the covariance of any two of the random variables to be 0.104, then you can find the corresponding $c$ parameter of the "Clayton" kernel with

d = ProbabilityDistribution[-3 (x^2 - 40 x + 200 Log[x] + 300 - 200 Log[10])/2000,
{x, 0, 10}];
μ = Expectation[x, x \[Distributed] d]
FindRoot[NIntegrate[(x1 - μ) (x2 - μ) PDF[CopulaDistribution[{"Clayton", c}, {d, d}], {x1, x2}],
{x1, 0, 10}, {x2, 0, 10}] == 0.104, {c, 6.7}]
(* .... Lots of warning messages.... *)
(* {c -> 6.67695} *)

• Some helpful intro to Copulas can be found on Stats.SE (e.g. here). – gwr Aug 18 '16 at 14:19
• This is what I was looking for. Thanks! – BPinto Aug 18 '16 at 20:49