Difference between revisions of "Is it chance? Use a T-Test to identify how likely an intervention worked"

From Personal Science Wiki
Jump to navigation Jump to search
m (link excel)
Line 1: Line 1:
== Problem ==
+
A frequent problem in personal science is that you tried an intervention and want to see if it worked. But you are unsure whether any differences you observed are maybe just by chance. So how can you see how likely is it that the results were chance?
  
You tried an intervention and want to see if it worked. How likely is it that the results were chance?
+
== Solution ==
  
== Solution ==
+
One of the simplest tests is a '''T-Test''', sometimes called a “Student T Test”<ref>https://en.wikipedia.org/wiki/Student%27s_t-test</ref>, which provides you with a ''p-value'' after doing the t-test. Generally, statisticians use the concept of ''p-value''s to discuss how often you would expect to observe the effect you did observe just by chance. A a simplified example, a p-value of 0.05 means that you would randomly observe this effect in 5 out of 100 retries of your intervention just by pure chance. While this crude measure doesn’t describe all the ways something might happen due to chance, generally the lower the p-value, the better. 
  
One of the simplest tests is a '''T-Test''', sometimes called a “Student T Test”.   
+
Professional scientists, especially those who understand statistics, are skeptical of claiming a result based purely on p-values, but for Personal Science purposes, it’s a good start. There is no “''correct”'' p-value cutoff that determines whether an effect is not due to chance alone, but traditionally people assume that any p-value that is smaller than 0.05 deserves a closer look and indicates that is probably a '''real''<nowiki/>' effect.   
  
Statisticians use the concept of ''P Value'' to discuss the how often a result might appear to be significant even when it’s not. While this crude measure doesn’t describe all the ways something might happen due to chance, generally the lower the P Value, the better. Professional scientists, especially those who understand statistics, will get touchy if you claim a result based purely on P Values, but for Personal Science purposes, it’s a good start. There is no “correct” cutoff value that can determine the likelihood that something is due to chance alone, but traditionally people assume that anything under 0.05 deserves a closer look.
+
== What you need ==
 +
To be able to perform a t-test you need your numerical data which is split into exactly two conditions.
  
 +
===t-tests in Excel===
 
Here’s an example for how to do this in [[Excel]].
 
Here’s an example for how to do this in [[Excel]].
  
Suppose you’d like to know if taking a melotonin supplement will help you sleep longer. You’ve measured your daily sleep, taking the supplements on some days (the “intervention”) and not on others (“control”).
+
Suppose you would like to know if taking a Melatonin supplement will help you sleep longer. You’ve measured your daily sleep, taking the supplements on some days (the “intervention”) and not on others (“control”).
  
A simple spreadsheet might look like this:
+
Your simple spreadsheet might look like this:
  
 
[[File:Excel file showing T test data.png|alt=Excel screen shot showing T Test Data|center|thumb|Compare an intervention with its affect on sleep.]]
 
[[File:Excel file showing T test data.png|alt=Excel screen shot showing T Test Data|center|thumb|Compare an intervention with its affect on sleep.]]
 
 
  
 
Track your sleep under two columns: one for nights when you took the supplement, and the other for nights you didn’t.
 
Track your sleep under two columns: one for nights when you took the supplement, and the other for nights you didn’t.
  
The built-in Excel statistical function <code>T.TEST</code> will calculate the P-Value when you give it two ranges, the “intervention” (nights we took melotonin) and the “control” (nights without).
+
The built-in Excel statistical function <code>T.TEST</code> will calculate the P-Value when you give it two ranges<ref>https://support.microsoft.com/en-us/office/t-test-function-d4e08ec3-c545-485f-962e-276f7cbed055</ref>, one for the “intervention” (the nights we took Melatonin) and the “control” (the nights without).
  
See the screenshot for the exact formula in this case:  
+
The formula for doing the t-test is this (see the screenshot for the exact formula in the example):  
  
 
<code>=T.TEST(array1,array2,tails,type)</code>
 
<code>=T.TEST(array1,array2,tails,type)</code>
  
Enter a `1` for `tails` (because we’re only interested in one measurement, sleep) and a `2` for type (because in this case our samples are not of the same length).
+
Enter a <code>1</code> for <code>tails</code> (because we’re only interested in one measurement, sleep) and a <code>2</code> for type (because in this case our samples are not of the same length).
  
The P Value in this example, `0.24`, is above `0.05` and therefore we will assume that any difference in sleep between the nights is due to pure chance.
+
The P Value in this example, <code>0.24</code>, is above <code>0.05</code> and therefore we will assume that any difference in sleep between the nights is due to pure chance.
  
 +
==References==
 +
<references />
 
{{Topic Queries}}
 
{{Topic Queries}}
 
[[Category:Topics]]
 
[[Category:Topics]]

Revision as of 11:16, 4 March 2022

A frequent problem in personal science is that you tried an intervention and want to see if it worked. But you are unsure whether any differences you observed are maybe just by chance. So how can you see how likely is it that the results were chance?

Solution

One of the simplest tests is a T-Test, sometimes called a “Student T Test”[1], which provides you with a p-value after doing the t-test. Generally, statisticians use the concept of p-values to discuss how often you would expect to observe the effect you did observe just by chance. A a simplified example, a p-value of 0.05 means that you would randomly observe this effect in 5 out of 100 retries of your intervention just by pure chance. While this crude measure doesn’t describe all the ways something might happen due to chance, generally the lower the p-value, the better.

Professional scientists, especially those who understand statistics, are skeptical of claiming a result based purely on p-values, but for Personal Science purposes, it’s a good start. There is no “correct” p-value cutoff that determines whether an effect is not due to chance alone, but traditionally people assume that any p-value that is smaller than 0.05 deserves a closer look and indicates that is probably a 'real' effect.

What you need

To be able to perform a t-test you need your numerical data which is split into exactly two conditions.

t-tests in Excel

Here’s an example for how to do this in Excel.

Suppose you would like to know if taking a Melatonin supplement will help you sleep longer. You’ve measured your daily sleep, taking the supplements on some days (the “intervention”) and not on others (“control”).

Your simple spreadsheet might look like this:

Excel screen shot showing T Test Data
Compare an intervention with its affect on sleep.

Track your sleep under two columns: one for nights when you took the supplement, and the other for nights you didn’t.

The built-in Excel statistical function T.TEST will calculate the P-Value when you give it two ranges[2], one for the “intervention” (the nights we took Melatonin) and the “control” (the nights without).

The formula for doing the t-test is this (see the screenshot for the exact formula in the example):

=T.TEST(array1,array2,tails,type)

Enter a 1 for tails (because we’re only interested in one measurement, sleep) and a 2 for type (because in this case our samples are not of the same length).

The P Value in this example, 0.24, is above 0.05 and therefore we will assume that any difference in sleep between the nights is due to pure chance.

References

Linked content on this wiki

(The content in the table below is automatically created. See Template:Topic Queries for details. If newly linked pages do not appear here, click on "More" and "Refresh".)

Tools related to this topic  
Excel
Projects related to this topic  
Self researchers related to this topic  
We talked about this topic in the following meetings