SBC icon indicating copy to clipboard operation
SBC copied to clipboard

chisq test pvalue as a measure

Open hyunjimoon opened this issue 3 years ago • 1 comments

using pvalue as a global summary could be misleading as the following example suggests:

a <- c(51, 53, 52, 40, 44, 48, 46, 57, 51, 40, 55, 58, 48, 52, 38, 49, 51, 69, 57, 41)
b <- c(46, 41, 42, 53, 52, 44, 50, 50, 46, 49, 49, 45, 64, 55, 44, 50, 46, 50, 55, 69)
sum(a) == sum(b)
chisq.test(a)$p.value # 0.332
chisq.test(b)$p.value # 0.506
pval.3 <- data.frame(length= a)
pval.5 <- data.frame(length = b)
pval.3 $veg <- 'pval.3 '
pval.5$veg <- 'pval.5'
vegLengths <- rbind(pval.3, pval.5)
ggplot(vegLengths, aes(length, fill = veg)) + 
  geom_histogram(alpha = 0.5, aes(y = ..density..),bins = 20, position = 'identity')

image

hyunjimoon avatar Dec 11 '20 06:12 hyunjimoon