rp-valuemanova

How to extract p value from Manova output


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


Solution

  • 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.