I noticed that the summary.manova()
function in R produces two different p.values. One in a table that is printed in the console and the other in the stats
table located in the summary object. What p.values should be reported? The values are slightly different. I first noticed this problem when using the tidy()
function from broom
, it was reporting p.values from the stats table and not the console.
I can recreate the problem using the iris data frame:
head(iris)
fit = manova(as.matrix(iris[,1:4]) ~ Species, data = iris)
fit_summary = summary.manova(fit, test = "Wilks")
fit_summary #output1
fit_summary$stats #output2
broom::tidy(fit, test = "Wilks") #output2
Nice reproducible example! From everything I can see here, the only differences are in output representation, not in the underlying values.
In the printed summary output, p-values less than a threshold are printed only as "<2.2e-16" (on the theory that you probably shouldn't be worrying about differences among tiny p-values anyway ...)
If you explicitly extract the
$stats
component, then you get a value printed to R's default 7-digit precision:If you use
tidy
, it returns a tibble rather than a data frame, which has a different set of defaults for output precision (i.e., it only reports 3 significant digits).All of these defaults can be reset: for example,
?tibble::formatting
tells you thatoptions(pillar.sigfig=7)
will set the significant digits for tibble-printing to 7;?options
tells you that you can useoptions(digits=n)
to change the defaults for base-R printing.