2

I am testing the Hotelling T^2 test via the manova formula in R. I am testing different same sizes and so have multiple Manova table output. Below is how I generated the manova for the entire sample

attach(iris)
library(Hotelling)
library(corpcor)
s= iris[1:100,1:5]
input= cbind(s$Sepal.Length,s$Sepal.Width, s$Petal.Length, s$Petal.Width )
m= manova(input~ Species, data = s)
summary(m, "Hotelling-Lawley")

I was wondering how I could extract the p value from each table. I tried to following but had no such luck:

res$"Pr(>F)"

res$p.value

summary(man)[8]

but each return NULL

daisybeats
  • 217
  • 1
  • 6

1 Answers1

2

In your example, p is very small:

summary(m, "Hotelling-Lawley")$stats

          Df Hotelling-Lawley approx F num Df den Df       Pr(>F)
Species    1         26.33509 625.4583      4     95 2.664857e-67
Residuals 98               NA       NA     NA     NA           NA

The p-value can be isolated for a given predictor, e.g. Species, like this:

summary(m, "Hotelling-Lawley")$stats["Species", "Pr(>F)"]
[1] 2.664857e-67

Docs here.

I know this is just a test case with iris, but even so: consider that when a p-value is this small, it begins to lose meaning as a valid test statistic. You might instead choose a measure of effect size, or even descriptive statistics, to support your results.

andrew_reece
  • 20,390
  • 3
  • 33
  • 58
  • Thank you. I was just wondering why I get two different p values for each different line. Firstly `summary(m, "Hotelling-Lawley")` gives a P value of `2.2e-16` for Species. While `summary(m, "Hotelling-Lawley")$stats` gives a p value of `2.664857e-67` – daisybeats Sep 26 '20 at 06:49
  • 1
    If you look at the other values in `summary()` vs `summary()$stats` you can see they are all rounded. But the p-value is so small that R defaults to [machine epsilon](https://stackoverflow.com/questions/2619543/how-do-i-obtain-the-machine-epsilon-in-r) in the `summary()` output. You can see the actual value when you go a level deeper, in `$stats`. – andrew_reece Sep 26 '20 at 06:52