Viking553
Viking553

Reputation: 27

t-test and computing p-values in R

There is a data set "Wine" from pack "candisc". The task is to compare "grignolino" and "barbera" in turms of their parameter AlcAsh with the use of t-test. What is the p-value? The answer is to be given with rounding to the fifth digit.

I took an attempt to solve the task, here is the code.

dat<-Wine[Wine$Cultivar == c('grignolino', 'barbera'), ]
tt<-t.test(AlcAsh~Cultivar, dat)
tt$p.value
[1] 0.01467608

The p-value was computed incorrectly. What the problem might be?

Upvotes: 1

Views: 84

Answers (1)

Chuck P
Chuck P

Reputation: 3923

LOL lots of possibilities lets start with:

dat<-Wine[Wine$Cultivar %in% c('grignolino', 'barbera'), ]
tt<-t.test(AlcAsh~Cultivar, dat, var.equal = TRUE)
tt$p.value
[1] 0.03519209
tt<-t.test(AlcAsh~Cultivar, dat, var.equal = FALSE)
tt$p.value
[1] 0.02365085

or could be it's one-sided or ...

Upvotes: 2

Related Questions