Search code examples
statisticswolfram-mathematicanormal-distributioncdf

Mathematica: difficulty using Multinormal Distribution and InverseCDF functions


I'm struggling to use the functions MultinormalDistribution and InverseCDF in MultivariateStatistics package. Essentially

<< MultivariateStatistics`
sig = .5; u = .5;

dist = MultinormalDistribution[{0, 0}, sig*IdentityMatrix[2]];

delta=InverseCDF[dist, 1 - u]

The output is

InverseCDF[
 MultinormalDistribution[{0, 0}, {{0.5, 0}, {0, 0.5}}], {0.5}]

can someone correct the above code? If I've understood this correctly, delta should be a single number.


Solution

  • 1) MultinormalDistribution is now built in, so don't load MultivariateStatistics it unless you are running version 7 or older. If you do you'll see MultinormalDistribution colored red indicating a conflict.

    2) this works:

     sig = .5; u = .5;
     dist = MultinormalDistribution[{0, 0}, sig IdentityMatrix[2]];
     delta = CDF[dist, {xx, yy}]
    
     (*1/4 Erfc[-1. xx] Erfc[-1. yy]*)
    

    note it is a 2d distribution so that CDF needs two variables in its second argument. The "inverse" of this is a curve in {xx,yy} space. I don't think InverseCDF works for such multivariate distributions however.

    You can visualize your inverse like this:

      ContourPlot[delta == 1/2 , {xx, -2, 4}, {yy, -2, 4}]
    

    enter image description here