# Total Variation Distance(between Gaussians)

I am interested in a tool that calculates the total variation distance between two multivariate Normal distributions. Any help will be much appreciated as I am a complete beginner.(So far, I have searched for this tool in any programming language I know and to my surprise I haven't found anything. I am also not so sure that the tool that I have built is accurate.)

• Do you have Mathematica? Am I right in saying the total variation distance is the maximum of the absolute difference between the CDFs of the distributions? In which case it would be NMaximize[Abs[CDF[d1, x] - CDF[d2, x]], x] in Mathematica for given distributions d1, d2 – flinty Sep 16 at 15:27
• You got me. I don't actually have it. (I hope that doesn't mean that I can't post the question). I am looking where I can implement it first before installing a bunch of programs that may end up useless. Can you explain what $x$ is in your type? – cgss Sep 16 at 18:11
• x is just the variable that appears in the cumulative density functions of your normal distributions. Since Mathematica is not free you may want to look into R instead which has a package distrEx and this rdocumentation.org/packages/distrEx/versions/2.8.0/topics/… . – flinty Sep 16 at 22:01
• ^ oh yeah that's 1D only and you asked about multivariate. In Mathematica for 2D that would be NMaximize[Abs[CDF[d1, {x,y}] - CDF[d2, {x,y}]], {x,y}] and d1 and d2 would be MultinormalDistributions, assuming that's the correct definition for TVD. – flinty Sep 16 at 22:08
• To be honest I am not sure that's correct. It may be it's just that I don't know about it. – cgss Sep 17 at 8:41