Question

I have two sample data which are independent from each other. So I have to make a two-sample independent student's t-test with this data using R.

When I call this :

t.test(data1, data2, alternative = "less", paired = FALSE, var.equal = FALSE, conf.level = 0.95)

The output is this :

        Welch Two Sample t-test

data:  data1 and data2
t = -1.8795, df = 1121.445, p-value = 0.03022
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
       -Inf -0.2707661
sample estimates:
mean of x mean of y 
 45.08116  47.26238 

But I want to test whether data2 is greater than data1. This tests whether they are equal or not.

Although this test says that they are equal, hence testing data2 > data1 is meaningless, I would like to know just in case they were not equal, to find which one has a greater mean value.

Thanks for any help !

Was it helpful?

Solution

Just change the alternative parameter to

t.test(data1, data2, alternative = "greater", paired = FALSE, var.equal = FALSE, conf.level = 0.95)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top