<p>I was trying to calculate t-statistics using Python's <code>scipy</code> and <code>numpy as np</code>-</p>
<pre class="lang-py prettyprint-override"><code>scipy.stats.ttest_ind_from_stats(
    NP.mean(x[['GSM1224991', 'GSM1224992']]),
    NP.std(x[['GSM1224991', 'GSM1224992']]),
    len(['GSM1224991', 'GSM1224992']),
    NP.mean(x[['GSM1224993', 'GSM1224994']]),
    NP.std(x[['GSM1224993', 'GSM1224994']]),
    len(['GSM1224993', 'GSM1224994']),
)
</code></pre>
<p>For example in the dataset given below, <code>GSM1224991 &amp; GSM1224992</code> are in first group and <code>GSM1224993 &amp; GSM1224994</code> form second group.</p>
<pre><code>ID_REF,GSM1224991,GSM1224992,GSM1224993,GSM1224994
148000,6.436150368369428,6.499787040655854,4.430816798843313,3.0819099697950434
</code></pre>
<p>Here is the calculation given in GEO2R analysis for the same reference but while I calculate t test it is <code>0.029630766122806237</code> instead of <code>-0.33768</code> something as shown below.</p>
<pre><code>ID  adj.P.Val   P.Value t   B   logFC
148000  1   0.001426    -9.44   -0.33768    -2.513
</code></pre>
<p>How to calculate t-stat here? Or considering single row is wrong approach?</p>

<r><limma><geoquery>
How is the t-statistic value calculated in GEO2R or Bioconductor?
# How is the t-statistic value calculated in GEO2R or Bioconductor?

(Asked by: username_0 on 2021-03-04)

I was trying to calculate t-statistics using Python's scipy and numpy as np-
scipy.stats.ttest_ind_from_stats(
    NP.mean(x[['GSM1224991', 'GSM1224992']]),
    NP.std(x[['GSM1224991', 'GSM1224992']]),
    len(['GSM1224991', 'GSM1224992']),
    NP.mean(x[['GSM1224993', 'GSM1224994']]),
    NP.std(x[['GSM1224993', 'GSM1224994']]),
    len(['GSM1224993', 'GSM1224994']),
)

For example in the dataset given below, GSM1224991 & GSM1224992 are in first group and GSM1224993 & GSM1224994 form second group.
ID_REF,GSM1224991,GSM1224992,GSM1224993,GSM1224994
148000,6.436150368369428,6.499787040655854,4.430816798843313,3.0819099697950434

Here is the calculation given in GEO2R analysis for the same reference but while I calculate t test it is 0.029630766122806237 instead of -0.33768 something as shown below.
ID  adj.P.Val   P.Value t   B   logFC
148000  1   0.001426    -9.44   -0.33768    -2.513

How to calculate t-stat here? Or considering single row is wrong approach?

**Tags:** r, limma, geoquery

---

## 0 answers

