Simulistics - statistics
//www.simulistics.com/modeltags/statistics
enPaired t-test example
//www.simulistics.com/examples/catalogue/paired-t-test-example
<div class="field field-name-field-model field-type-text field-label-above"><div class="field-label">ModelId: </div><div class="field-items"><div class="field-item even">paired_ttest</div></div></div><div class="field field-name-field-simileversion field-type-text field-label-above"><div class="field-label">SimileVersion: </div><div class="field-items"><div class="field-item even">5.x</div></div></div><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>This is an example of a paired t-test which is supposed to show the role of a null model in making statistical inference.</p>
<p>In this example there are two samples, each with 20 observations. We want to know if the sample means are statistically different.</p>
<p>The statistical question is:</p>
<p> What is the chance that the two samples are measurements of the same process, and the observed difference happened purely by chance?</p>
<p> </p>
<p>To answer this question we could use a paired t-test. At its core the paired t-test has a null model.</p>
<p>The null model is that distribution of differences between the two samples is normal with a mean of zero and a variance equal to the observed variance. This model has assumptions. The two most obvious assumptions are 1/ The differences can be described with a normal distribution with the stated variance, 2/ The diferences are independent from one another.</p>
<p>Null models are normal described as a null hypothesis, with the assumptions tagged on the end. So the null hypothesis is that the mean difference between the samples is zero.</p>
<p>We want to know the probability of our observed difference if the null model had generated these data. </p>
<p>Since the normal distribution is relatively simple a paired t-test can calculate this probability exactly. But we could create the null model in simile, run the model many times, and then calculate the probability of generating a difference with the null model that is more extreme than our observations. With many runs of the null model (typically more than 1000), this probability is the p-value calculated by the paired t-test.</p>
<p> </p>
<p>Any other statistical test can be performed like this. For example, an ANOVA is very similar, but rather than comparing means it compares variances. An ANOVA has an underlying null model, with assumptions. As the null models become more complicated the mathematics becomes harder. For complicated systems simulation is the only possibility. Methods that rely on computer simulation to some extent are Approximate Bayesian Computing (ABC), and Monte-Carlo methods.</p>
<p>Attached ar 3 files:</p>
<p>The model file is paired_ttest.sml</p>
<p>The interface for viewing the results is paired_ttest.shf</p>
<p>And the data used in this example are in the file t_test_data.txt</p>
<p> </p>
<p>The model paired_ttest.sml calculates the two-sided and one-sided p-values from 1000 simulations of the null model. It also calculates the t-statistic and the dgrees of freedom which you can use to calculate the exact p-value with Students t-distribution.</p>
</div></div></div><div class="field field-name-upload field-type-file field-label-hidden"><div class="field-items"><div class="field-item even"><table class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><span class="file"><img class="file-icon" alt="Binary Data" title="application/octet-stream" src="/modules/file/icons/application-octet-stream.png" /> <a href="//www.simulistics.com/files/paired_ttest.sml" type="application/octet-stream; length=123919" title="paired_ttest.sml">paired_ttest.sml</a></span></td><td>121.01 KB</td> </tr>
<tr class="even"><td><span class="file"><img class="file-icon" alt="Binary Data" title="application/octet-stream" src="/modules/file/icons/application-octet-stream.png" /> <a href="//www.simulistics.com/files/paired_ttest.shf" type="application/octet-stream; length=1350" title="paired_ttest.shf">paired_ttest.shf</a></span></td><td>1.32 KB</td> </tr>
<tr class="odd"><td><span class="file"><img class="file-icon" alt="Plain text icon" title="text/plain" src="/modules/file/icons/text-plain.png" /> <a href="//www.simulistics.com/files/t_test_data.txt" type="text/plain; length=524" title="t_test_data.txt">t_test_data.txt</a></span></td><td>524 bytes</td> </tr>
</tbody>
</table>
</div></div></div><div class="field field-name-taxonomy-vocabulary-5 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Model tags: </div><div class="field-items"><div class="field-item even"><a href="/modeltags/null-model">null model</a></div><div class="field-item odd"><a href="/modeltags/paired-t-test">paired t-test</a></div><div class="field-item even"><a href="/modeltags/statistics">statistics</a></div></div></div>Mon, 11 May 2009 10:59:13 +0000jyearsle1548 at //www.simulistics.com//www.simulistics.com/examples/catalogue/paired-t-test-example#comments