Avoid conflict problem with the standard package MultivariateStatistics?

Hi everybody!

I’m trying to execute again an old notebook using simultaneously “MultinormalDistribution”, “EllipsoidQuantile” and “SpatialMedian”, and it doesn’t work any more. Here is a short example.

Clear["Global`*"];

Needs["MultivariateStatistics`"];
dist = MultinormalDistribution[{0, 
    0}, {{1.7632655763946026`, -1.6637745757032427`}, \
{-1.6637745757032427`, 3.2291056091906434`}}];

Bad sign: MultinormalDistribution is red (more than one context, etc.)…

Something from the documentation:

EllipsoidProbability[dist, EllipsoidQuantile[dist, .5]]

0.5: OK. Now let’s process a sample:

ech = RandomVariate[dist, 500];
Mean@ech
SpatialMedian[ech]

Nothing abnormal, but SpatialMedian is red, too…
Now, another example from the documentation, adapted to my data:

{{minx, maxx}, {miny, 
   maxy}} = ({Min[#], Max[#]} &) /@ {First@Transpose@ech, 
   Last@Transpose@ech}
q = EllipsoidQuartiles[ech];
Graphics[q, Frame -> True, AspectRatio -> 1, 
 PlotRange -> {{minx, maxx}, {miny, maxy}}]

No plot, but a nice pink window with the message:

Charting`Private`Tag$2889#1 is not a Graphics primitive or directive.

What should I do?

Best regards,
Claude

Hi, Find a notebook attached with everything worked out. Graphics may depend on the PC; it works for me in a Windows PC with Intel graphics. MultinormalDistribution is a system function from Mathematica 8 onwards, specifying that helps. Also, you need to use RandomReal, and not RandomVariate in this context.

Dear Gokul,

thanks a lot for reminding me of the existence of contexts!

Needs["MultivariateStatistics`"]
dist = System`MultinormalDistribution[{0, 0},
   {{1.7632655763946026`, -1.6637745757032427`}, \
{-1.6637745757032427`, 3.2291056091906434`}}];
ech = RandomReal[dist, 500];
Mean@ech
System`SpatialMedian[ech]
{{minx, maxx}, {miny, 
   maxy}} = ({Min[#], Max[#]} &) /@ {First@Transpose@ech, 
   Last@Transpose@ech}

works perfectly. Nevetheless, on my machine (Mathematica version 11.1)

Graphics[EllipsoidQuartiles[ech]]

results in an error and I have to use Map to obtain something correct:

Show[ListPlot[ech, PlotRange -> All], 
 Map[Graphics, EllipsoidQuartiles[ech]], Frame -> True]

I didn’t met this problem with earlier versions, as far as I remember.

Claude