1
$\begingroup$

Is there a way to produce the inverse value of multinormal distribution function in CDF format with 0.05 significance level?

I found the function called MultinormalDistribution but I could not find the way to calculate the inverse value of this.

Is there a function or a method that can derive the inverse value of this MultinormalDistribution?

Thank you very much in advance.

$\endgroup$
  • $\begingroup$ Inverse values of PDF,CDF or what ? $\endgroup$ – b.gates.you.know.what Nov 9 '14 at 13:41
  • $\begingroup$ @b.gatessucks: I've amended the question. You'll see what it is. $\endgroup$ – Eric Nov 9 '14 at 15:42
4
$\begingroup$
dist = MultinormalDistribution[
   {0, 0}, {{1, 0}, {0, 1}}];

PDF[dist, {x, y}]

E^((1/2)*(-x^2 - y^2))/(2*Pi)

CDF[dist, {x, y}]

(1/4)*Erfc[-(x/Sqrt2)]*Erfc[-(y/Sqrt2)]

The inverse CDF is not unique. To simplify the problem I will find the inverse CDF with y == x

Show[
 ContourPlot[
  CDF[dist, {x, y}],
  {x, -3, 3}, {y, -3, 3},
  Contours ->
   {.1, .25, .5, .75, .9, .95, .99}],
 Plot[Tooltip[x, "y = x"],
  {x, -3, 3},
  PlotStyle -> Red]]

enter image description here

inverseCDF[q_?NumericQ] := 
  t /. NSolve[CDF[dist, {t, t}] == q, t][[1]] //
   Quiet;

inv = inverseCDF[.95]

1.95451

Plot[inverseCDF[q], {q, .001, .999},
 PlotRange -> All,
 Epilog -> {Red, AbsoluteDashing[{5, 5}],
   Line[{{0, inv}, {.95, inv}, {.95, 0}}]}]

enter image description here

EDIT: For higher dimensional distributions

dim = 4;

dist = MultinormalDistribution[ConstantArray[0, dim], 
   IdentityMatrix[dim]];

For all of the variables equal,

inverseCDF[q_?NumericQ] := 
  t /. NSolve[CDF[dist, ConstantArray[t, dim]] == q, t][[1]] // Quiet;

inv = inverseCDF[.95]

2.234

Plot[inverseCDF[q], {q, .001, .999}, PlotRange -> All, 
 Epilog -> {Red, AbsoluteDashing[{5, 5}], 
   Line[{{0, inv}, {.95, inv}, {.95, 0}}]}]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you so much. This is exactly what I was looking for! By the way, may I ask what "[q_?NumericQ]" mean here? I am not sure especially how the question mark comes in. Anyway, thank you very much. $\endgroup$ – Eric Nov 9 '14 at 16:53
  • $\begingroup$ ?NumericQ is a PatternTest (highlight ? and hit F1 for help) that limits evaluation of the function inverseCDF to numeric arguments. This is necessary since the function uses a numeric technique (i.e., NSolve). NSolve cannot work with a symbolic q. $\endgroup$ – Bob Hanlon Nov 9 '14 at 17:01
  • $\begingroup$ Thank you very much. I would like to ask one more question if you don't mind. If I am trying to set the numbers of "t"s to be equal to the covariance dimension (especially with the column dimensions) that I set up, then how can I reflect this into my code? For example, in "NSolve[CDF[dist, {t, t}] == q, t]", if my covariance is dimension 4, then I should have "NSolve[CDF[dist, {t, t,t,t}] == q, t]". Is there a way to make this synchronized with the covariance matrix that I produce? Thank you very much again for your tremendous helps. $\endgroup$ – Eric Nov 9 '14 at 17:33
  • $\begingroup$ Thank you very much again. I really do appreciate your help. Then, does this "dim" automatically give the dimension of the covariance matrix..? Or should I define this "dim" separately..? $\endgroup$ – Eric Nov 9 '14 at 19:04
  • $\begingroup$ See edit above. $\endgroup$ – Bob Hanlon Nov 9 '14 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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