# Generate a sample from a multivariate Cauchy distribution

I want to generate a random sample from a multivariate Cauchy distribution, however I couldn't find a function for the multivariate Cauchy in Mathematica. I know how to define a distribution in 1D and tried to do this in a similar way

MultivariateCauchy[x_, μ_, Σ_, k_] := Gamma[(1 + k)/2]/(Gamma[1/2] π^(k/2) Sqrt[Det[Σ]]
(1 +(Transpose[x -μ].Inverse[Σ].(x -μ))^((1 + k)/2)))

MCdist[μ_, Σ_, k_] := ProbabilityDistribution[MultivariateCauchy[x, μ, Σ, k], {x, -∞, ∞}]


where $\mu$ is the location vector, $\Sigma$ a positive definite covariance matrix and a free scalar parameter $k$. However, this does not work with RandomVariate. Is there a way to do this?

• Why not use MultivariateTDistribution with v = 1? – Andy Ross Mar 16 '15 at 22:35

RandomVariate is only implemented for certain distributions and frequently fails for custom probability distributions.

Perhaps, this might be helpful (noting multivariate T is multi-Cauchy) but I am happy to delete if my post is wrong or ill-conceived.

fun[s_, k_, a_, b_] :=
k}, {CauchyDistribution[a, b], CauchyDistribution[a, b]}]


An example:

dist2 = fun[{{1, 0.7}, {0.7, 1}}, 1, 1, 1]


Observations:

Quiet@Plot3D[Evaluate[PDF[dist2, {x, y}]], {x, -2, 2}, {y, -2, 2}]


test = RandomVariate[dist2, 1000];
Correlation @@ Transpose[test]


yielded 0.79

EstimatedDistribution[test[[All, 1]], CauchyDistribution[a, b]]


yielded: CauchyDistribution[1.01444, 1.01174]

DistributionFitTest[test[[All, 1]],
CauchyDistribution[1.0144439384993755, 1.0117371023486896]]


yielded: 0.914376

EstimatedDistribution[test[[All, 2]], CauchyDistribution[a, b]]


yielded: CauchyDistribution[1.04505, 1.00878]

and

DistributionFitTest[test[[All, 2]],
CauchyDistribution[1.0450545242904905, 1.0087772896376905]]


yielded: 0.229244

If I have misconceived let me know and I will delete.