10

Is there a multivariate normality test available in any of packages in Python?

I have heard of some scipy functions but are they applicable to multivariate data? I have a dataset with 30000 datapoints each point with 1024 variables. I want to check if these variables have multivariate normal distribution. How do I do this in Python.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kanmani
  • 479
  • 7
  • 21
  • Any update on assessing multivariate normality in python? Like the MVN package in R. Any equivalent in python? – seralouk Sep 14 '18 at 09:18
  • I havent needed to do multivariate normality test for a long time now, I dont think they have any libraries catering to it yet. – Kanmani Sep 18 '18 at 01:54
  • 1
    Yes, see here an MVN test in Python: https://pingouin-stats.org/generated/pingouin.multivariate_normality.html – Florin Andrei Jul 10 '22 at 01:17

1 Answers1

1

Using scipy you can create samples of random variable from multivariate normal distribution. See here.

If you already have a sample that was generated using multivariate normal distribution, but you don't know its parameters, you can use maximum likelihood estimator to estimate them (see this example).

If you have a sample and you want to test if it was generated using multivariate normal distribution, you can use goodness of fit test. See this discussion for relevant scipy methods.

Community
  • 1
  • 1
Miriam Farber
  • 18,986
  • 14
  • 61
  • 76
  • Thanks for taking the time. I went through the goodness of fit tests in scipy stats models and they all seem to require their input parameter x i.e the data matrix to be 1-d array. If I am not wrong in my understanding, then that means these scipy tests are for univariate data, right ? – Kanmani Mar 29 '17 at 07:17
  • 1
    @chilvandu yes it seems to be the case. One option is to calculate the chi-square test statistics yourself and then look for the p-value, as in this example: https://onlinecourses.science.psu.edu/stat414/node/259 – Miriam Farber Mar 29 '17 at 07:31
  • 4
    Any update on assessing multivariate normality in python? Like the MVN package in R? Any equivalent in python? – seralouk Sep 14 '18 at 09:18
  • @seralouk MVN test in Python: https://pingouin-stats.org/generated/pingouin.multivariate_normality.html – Florin Andrei Jul 10 '22 at 01:16