0

I am trying to conduct a paired t-test and generate a resulting p-value for some methylation data that I have.

The data is in 6 columns: 3 for each patient before treatment and 3 for each patient after treatment. There is one row for each gene (several thousand), and values range from [0,1].

I'd like to conduct a t-test for each row and ultimately generate one p-value for each gene. In this paired t-test, you'd have the value in [1,1], paired up with [1,4], [1,2] with [1,5], and [1,3] with [1,6].

I do not want to use the limma package since this is not strictly array data. Can you use limma for non-array data?

How would I go about conducting each t-test and generating the resulting p-values?

Below is what I am running right now, but R returns "Error in t.test.default(cg.t[i, c(1, 3, 5)], cg.t[i, c(2, 4, 6)]) : not enough 'x' observations"

pValue <- numeric(0)
for(i in seq(nrow(df)))
  pValue  <-  c(pValue,
                t.test(df[i,c(1,3,5)],
                       df[i,c(2,4,6)])$p.value)

Please excuse my naivety, as I am a just a novice biostatistician in my first year working with R. Your help is appreciated.

pogibas
  • 27,303
  • 19
  • 84
  • 117
  • 1
    Can you post a [minimal reproducible example](https://stackoverflow.com/help/mcve) that includes a large enough subset of your data to make sense (say, 20 rows)? There's a lot going on this question which depends upon what you're actually trying to do - not enough information to know if the regular base R function `t.test()` would work for you; if your question should be edited and migrated to Cross Validated to get more specific help on `bioconductor` usage, etc – HFBrowning Jul 07 '17 at 22:28
  • Inferring from your question and the error, you are just comparing one data point/score/observation using the `t.test()` which is definitely not enough to perform the test. Are you sure you want to do the comparison per-patient-per-gene wise or just the regular paired t-test per patient? In that case `t.test(df[,1],df[,4])` should work. – tushaR Oct 27 '17 at 10:15

0 Answers0