Search code examples
rmavenmultivariate-testingiris-dataset

How to fix the error "argument "modelName" is missing, with no default" when using MVN package


I am using the MVN package, in R, to find whether each class of the dataset iris is multivariate normal or not. I used the below code earlier in the day and generated results from it. However, I went to revisit it and now keep getting the following error message:

Error in mvn(data = iris[Species == m[1], 1:4], mvnTest = c("mardia")) : 
  argument "modelName" is missing, with no default

Can not figure out what this means and how to fix it !

Code:

#Mardia's Test
SM<-mvn(data=iris,subset="Species", mvnTest="mardia")

SM$multivariateNormality

SetosaPlot<-mvn(data=iris, subset="Species", multivariatePlot="qq")

Solution

  • You loaded the mclust package. When you did so you should have seen a warning

    The following object is masked from ‘package:MVN’: mvn

    So now mvn() is calling mclust::mvn() (i.e. the mvn function in the mclust package) rather than MVN::mvn().

    • In general you can make sure you get the version from the MVN package by using
    MVN::mvn(data=iris, subset="Species", multivariatePlot="qq")
    
    • If you want to know where R is finding mvn, try find("mvn")
    • In general, to resolve these kinds of problems you should start a clean R session, so that you know you're starting with no packages loaded.

    (By the way, no real data set is ever truly multivariate normal; you're not testing "whether it is MVN or not", but rather whether it is close enough to MVN that you can't reject the null hypothesis of multivariate normality ...)