0

I want to check whether the purchase intention of a product is affected by a label. I did a t-test t.test(myfile$Purch_Int~myfile$Product) and got

mean in group 0 = 3.757

mean in group 1 = 3.883

but when I ask for the mean myfile[Product== 1, mean(Purch_Int), by = Label] I get:

mean in group 0 = 3.938

mean in group 1 = 3.821

Why is there such a big difference?

Thanks in advance

  • 3
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. What is the `Label` column that wasn't used in the `t.test()` function? – MrFlick Jul 14 '21 at 21:28
  • you have selected different groups. In the t test you group by product. In mean, you filter to product==1 then group by Label. These should be expected to differ – dww Jul 14 '21 at 23:13

0 Answers0