2
$\begingroup$

I was just wondering, when I call the CopulaDistribution function in Mathematica, am I calling its cumulative function or its density function?

I have looked up the help and am still a little bit unsure.

EDIT: In particular, what does it mean when I take a RandomVariate from this CopulaDistribution? Surely I would have to sample from either the CDF or PDF.

$\endgroup$
5
  • 4
    $\begingroup$ Neither. A distribution is a distribution and its cumulative function and density function can be thought of as properties of that distribution which you can get at using the function CDF and PDF, respectively. $\endgroup$ Commented Dec 22, 2014 at 7:13
  • $\begingroup$ So if I do RandomVariate[CopulaDistribution[...]], what essentially am I doing? $\endgroup$
    – Jim
    Commented Dec 22, 2014 at 7:15
  • 4
    $\begingroup$ You are drawing random numbers from the copuladistribution with the given parameters. A histogram of those numbers will look like its PDF and the cumulation of those numbers will look like its CDF. $\endgroup$ Commented Dec 22, 2014 at 7:18
  • 7
    $\begingroup$ This question appears to be off-topic because it is more about the poster's unfamiliarity with distribution/PDF/CDF terminology than with their implementation in Mathematica. $\endgroup$ Commented Dec 22, 2014 at 10:46
  • 4
    $\begingroup$ This question appears to be off-topic because it is about the poster's unfamiliarity with distribution/PDF/CDF terminology than with their implementation in Mathematica $\endgroup$
    – Rojo
    Commented Dec 30, 2014 at 1:50

2 Answers 2

8
$\begingroup$

The question is of some interest because it captures rather nicely the difference between:

A. mathematical statistics ... where we work with characterisations of distributions, such as starting with a pdf, or cdf, or cf ... e.g. Let $X$ be a random variable with pdf $f(x)$:

$$f(x) = 1 -|x| \quad \text{for}\quad x\in(-1,1)$$

and

B. Mathematica's implementation of distributions ... which defines black box names to distributions that return nothing themselves ... but which we can then ask for a PDF or CDF or other characterisation from.

In this regard:

  • The poster asks whether CopulaDistribution returns the pdf or the cdf? And the answer is neither.

  • What does it return? Generally nothing.

Rather, CopulaDistribution .... like TransformedDistribution or MarginalDistribution, ... are Mathematica functions that don't actually seem to do anything. Do they involve any computation? No. Do they take up any processing cycles? No. They just return exactly what you enter e.g.

CopulaDistribution[{"FGM", .2}, {NormalDistribution[-1, 2], NormalDistribution[1, 1/2]}]

returns instantly:

CopulaDistribution[{"FGM", .2}, {NormalDistribution[-1, 2], NormalDistribution[1, 1/2]}]

Similarly:

TransformedDistribution[x^4, x \[Distributed] NormalDistribution[0, 1]

returns instantly the same input we entered ...

TransformedDistribution[x^4, x [Distributed] NormalDistribution[0, 1]

It doesn't even try to compute anything.

The only exception to this, that I am aware of, is where the solution is written up in advance ... much like a textbook appendix. So, for example:

TransformedDistribution[x^2, x \[Distributed] NormalDistribution[0, 1]]

ChiSquareDistribution[1]

... but no calculation or derivation is involved in this. It is just an appendix lookup (which is actually rather un-Mathematica-like, in my view).

RE comments: I don't know what is meant by a 'distribution is a distribution', and I think it is inherently wrong to suggest that distributions are black boxes, because it is not the way we tend to work or think about distributions in mathematical statistics. The starting point in mathematical statistics is not to define a black box, but to define a pdf (or a cdf or a cf). In effect, this is what Mathematica ultimately has to do anyway when we define our own custom density ... except that you have to manually create this artificial black box or placeholder, using:

dist = ProbabilityDistribution[1 - Abs[x], {x, -1, 1}]

ProbabilityDistribution[1 - Abs[x], {x, -1, 1}]

or CopulaDistribution or MarginalDistribution or ...

Once the black box is created, you can then 'operate' on it using PDF or CDF etc. The same goes for CopulaDistribution ... you have created a black box, and if you want something calculated, you will have to apply PDF or CDF etc to the latter.

$\endgroup$
5
  • $\begingroup$ The last example has a typo "Abx" instead of "Abs", which explains the error. $\endgroup$ Commented Dec 22, 2014 at 15:38
  • 2
    $\begingroup$ I would argue its not quite true to claim that mathematica returns the same as the input: it uses mute variables, which is reassuring as it shows it understood the input. $\endgroup$
    – chris
    Commented Dec 22, 2014 at 15:46
  • $\begingroup$ @RomkeBontekoe Fixed typo - thanks. $\endgroup$
    – wolfies
    Commented Dec 22, 2014 at 15:48
  • $\begingroup$ What if I call on the RandomVariate of this CopulaDistribution. Am I taking a random variate of the CDF or the PDF? $\endgroup$
    – Jim
    Commented Dec 22, 2014 at 22:05
  • 1
    $\begingroup$ You would be generating a pseudorandom sample from the distribution. If you generated a large number of such samples, the empirical pdf of your samples (or histogram of your samples) would resemble the pdf. $\endgroup$
    – wolfies
    Commented Dec 23, 2014 at 3:49
-1
$\begingroup$

I recently asked WRI about a similar behaviour on probability distributions. The answer was that the output IS generated, but erroneously the result IS NOT displayed.

Try

dist = ProbabilityDistribution[1 - Abs[x], {x, -1, 1}]

with

Mean[dist]

(* out 0 *)

or

cdist = CopulaDistribution[{"FGM", .2}, {NormalDistribution[-1, 2], 
NormalDistribution[1, 1/2]}]

with

Mean[cdist]
Variance[cdist]

(* out {-1, 1} and {4, 1/4} *)

So it does work. However, it is confusing.

$\endgroup$
2
  • 1
    $\begingroup$ but dist=ProbabilityDistribution[1 - Abs[x], {x, -1, 1}] does return something which is different from the input. $\endgroup$
    – chris
    Commented Dec 22, 2014 at 15:59
  • $\begingroup$ The reason for my down vote is that I don't feel this addresses the question at hand and would be more fitting as a comment or in chat. $\endgroup$
    – Andy Ross
    Commented Dec 23, 2014 at 22:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.