0

I would like to calculate the statistical significance of the following data by using two sided students t-test.

  > data
      label data1 data2
1       sam 0.052 0.010
2  immanuel 0.051 0.009
3     jolly 0.042 0.008
4     edwin 0.044 0.011
5     jesus 0.027 0.007
6       joy 0.027 0.007
7    aleena 0.046 0.009
8     raphy 0.034 0.008
9     geoge 0.015 0.004
10     tony 0.038 0.008
11    tomas 0.042 0.009
12  raphael 0.046 0.007
13    johny 0.021 0.007
14     alen 0.027 0.009
15    ninan 0.022 0.003
16     luke 0.005 0.002
17    afsal 0.084 0.014
18    kiran 0.029 0.007
19    subin 0.038 0.008
20     pijo 0.005 0.003
> t.test(data$data1, data$data2, paired=TRUE)

    Paired t-test

data:  data$data1 and data$data2
t = 7.8528, df = 19, p-value = 2.206e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.01998704 0.03451296
sample estimates:
mean of the differences 
                0.02725 

I would like to know that which labels have statistical significance? Is it possible to print the labels having statistical significance? I appreciate your help!

martin
  • 1
  • I think you are misunderstanding what you are achieving with this test. You might want to ponder [this](http://stats.stackexchange.com/questions/60946/how-to-perform-t-test-in-r-including-hypothesis) – Shawn Mehan Oct 14 '15 at 04:32
  • you just know that there is a significant difference between data1 and data2 not between lables – Mateusz1981 Oct 14 '15 at 05:41
  • 1
    What you have tested is, if the means of the two columns (`data1` and `data2`) are significantly different, which ist the case here (as the p-value of the null hypothesis that the means are not different is very small - 2.206e-07) – DatamineR Oct 14 '15 at 07:59
  • This is more a methods question than a coding question. – IRTFM Oct 14 '15 at 15:22

1 Answers1

0

May be you can:

data <- data.frame(label=letters,data1=rnorm(26),data2=rnorm(26))
data <- cbind(data,dif=data$data1-data$data2)
data[with(data,order(dif)),]
data[order(data$dif),] #another method

This will give you the maximum difference between data1 and data2 for every labels and sort according to the differences. for how to sort data.frame: How to sort a data frame in R

Community
  • 1
  • 1
pengchy
  • 732
  • 2
  • 14
  • 26