lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Hypothesis testing.html (11409B)


      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3 <html><head><link rel="stylesheet" href="sitewide.css"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content="Evernote Mac 7.6 (457297)"/><meta name="altitude" content="-4.208069801330566"/><meta name="author" content="Alex Balgavy"/><meta name="created" content="2018-12-16 00:43:30 +0000"/><meta name="latitude" content="52.30035400390625"/><meta name="longitude" content="4.988170682800604"/><meta name="source" content="desktop.mac"/><meta name="updated" content="2018-12-16 01:28:09 +0000"/><title>Hypothesis testing</title></head><body><h1>Hypothesis testing</h1><div style="-en-paragraph:true;">If
      4 <img src="Hypothesis%20testing.resources/7A1BCF62-8BA7-41B5-AF4A-F683F306D4CA.png" height="8" width="8"/> is known, use Z scores. If not, use T scores and
      5 <img src="Hypothesis%20testing.resources/9BB450C5-1027-455B-9017-181596524970.png" height="10" width="13"/> (or if sample size is below 30).</div><div style="-en-paragraph:true;"><br/></div><h2>The steps</h2><ol><li><div style="-en-paragraph:true;">Choose population parameter</div></li><li><div style="-en-paragraph:true;">Formulate null and alternative hypotheses. Choose significance level.</div></li><ul><li><div style="-en-paragraph:true;">H0: parameter = some value</div></li><li><div style="-en-paragraph:true;">HA: depends, can be two-tailed or one-tailed</div></li><ul><li><div>one-tailed: param &lt; value or param
      6 &gt;
      7 value</div></li><li><div>two-tailed: param ≠ value</div></li></ul></ul><li><div style="-en-paragraph:true;">Collect data.</div></li><li><div style="-en-paragraph:true;">Choose test statistic (based on parameter) and identify its distribution under H0H_0H0</div></li><li><div style="-en-paragraph:true;">Calculate value of test statistic.</div></li><li><div style="-en-paragraph:true;">Find p-value, or critical region based on significance.</div></li></ol><ul><li><div>watch out for the critical region. if two-tailed test, have to divide significance by 2 first.</div></li></ul><ol start="7"><li><div>Decide whether or not to reject the null hypothesis:
      8 </div></li><ul><li><div>p-value:
      9 </div></li><ul><li><div>if p-value ≤ significance, reject</div></li><li><div>otherwise, fail to reject</div></li></ul><li><div>critical values:
     10 </div></li><ul><li><div>if Z-score or T-score not in critical region, fail to reject</div></li><li><div>otherwise, reject</div></li></ul></ul></ol><div style="-en-paragraph:true;"><span style="font-weight: bold;"><br/></span></div><div style="-en-paragraph:true;"><span style="font-weight: bold;">YOU NEVER ACCEPT HYPOTHESES</span></div><div style="-en-paragraph:true;"><span style="font-weight: bold;"><br/></span></div><h2>Errors in testing</h2><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 130px;"/><col style="width: 130px;"/><col style="width: 130px;"/></colgroup><tbody><tr><td style="width: 130px; padding: 8px; border: 1px solid;" /><td style="width: 130px; padding: 8px; border: 1px solid;">H0 true</td><td style="width: 130px; padding: 8px; border: 1px solid;">H0 false</td></tr><tr><td style="width: 130px; padding: 8px; border: 1px solid;">reject H0</td><td style="width: 130px; padding: 8px; border: 1px solid;">Type I</td><td style="width: 130px; padding: 8px; border: 1px solid;">fine</td></tr><tr><td style="width: 130px; padding: 8px; border: 1px solid;">not reject H0</td><td style="width: 130px; padding: 8px; border: 1px solid;">fine</td><td style="width: 130px; padding: 8px; border: 1px solid;">type II</td></tr></tbody></table><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     11 <br/><img src="Hypothesis%20testing.resources/933656F9-8F0F-4893-9A44-4A01FBAF7807.png" height="18" width="273"/></span></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     12 <br><img src="Hypothesis%20testing.resources/3414AB71-8448-4162-8DE8-DED5892D0A44.png" height="18" width="561"/></span></div><div style="-en-paragraph:true;"><span style="font-size: 16px;"><br/></span></div><h2>Proportion test</h2><div style="-en-paragraph:true;">test statistic:</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     13 <img src="Hypothesis%20testing.resources/0E385596-9840-4183-A55A-D0FFEE289664.png" height="56" width="94"/></span></div><div style="-en-paragraph:true;"><span style="font-size: 16px;"><br/></span></div><h2>Mean test</h2><div style="-en-paragraph:true;"><span style="font-weight: bold;">Test statistic </span><span style="font-style: italic; font-weight: bold;">iff</span><span style="font-weight: bold;"> </span><b><span style="-en-paragraph:true;">σ</span></b><b> </b><span style="font-weight: bold;"> known:</span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     14 <img src="Hypothesis%20testing.resources/597ED042-0B26-423F-84E4-83B05096226F.png" height="46" width="86"/></span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">has standard normal distribution under null hypothesis.</div><div style="-en-paragraph:true;"><div><span style="font-weight: bold;"><br/></span></div><div><span style="font-weight: bold;">Test statistic otherwise:</span></div><div>
     15 basically just replace σ with its estimator 
     16 <img src="Hypothesis%20testing.resources/1C23AC31-18FC-4D37-915D-E1247246C251.png" height="31" width="21"/></div></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     17 <img src="Hypothesis%20testing.resources/3B12EF72-73BF-4CF2-857B-A6DBD194DA91.png" height="46" width="87"/></span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">has t-distribution with n−1 degrees of freedom under null hypothesis.</div><div style="-en-paragraph:true;"><span style="font-weight: bold;"><br/></span></div><div style="-en-paragraph:true;"><span style="font-weight: bold;">Confidence interval (1−α) for μ:</span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     18 <img src="Hypothesis%20testing.resources/FAEED6E9-9545-4D2C-8EC6-9A22C7EC43AD.png" height="35" width="245"/></span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">What does
     19 <img src="Hypothesis%20testing.resources/EE0ABF4A-E76D-4C1C-8D99-24B80A2476AB.png" height="15" width="48"/> mean? Well, we need a t-score, with n−1 degrees of freedom. Divide significance by 2 because α is the full area (both tails) and since we’re adding/subtracting a t-score, we want to find the score corresponding to the area in one tail.</div><div style="-en-paragraph:true;"><br/></div><h2>Two samples</h2><h3>Dependent</h3><div style="-en-paragraph:true;">dependent: values in one sample are related to values in the other sample, or form natural matched pairs</div><div style="-en-paragraph:true;"><div>to test, we look at the <span style="font-style: italic;">difference</span> of means.</div><div>
     20 null hypothesis can be either no difference, or that difference is a certain value. alternative hypothesis can basically be whatever.</div></div><div style="-en-paragraph:true;">calculate the differences for each x, then have a sample mean of differences
     21 <img src="Hypothesis%20testing.resources/C8BDC62C-982B-4A3C-B727-B79C999AEC3D.png" height="14" width="12"/> and standard deviation of differences
     22 <img src="Hypothesis%20testing.resources/7EFFA0D7-E377-4B0A-96D5-AD032CC72F30.png" height="10" width="13"/>.</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">test statistic:</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     23 <img src="Hypothesis%20testing.resources/FD339E08-317E-4225-B2E8-6349C7EF8937.png" height="46" width="140"/></span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">which under null hypothesis has t-distribution with n−1 degrees of freedom.</div><h3>Independent</h3><div style="-en-paragraph:true;">independent: no relationship between two samples</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><div><span style="font-weight: bold;">Assuming equal σ</span></div><div><br/></div><div>
     24 if sample randomly drawn from same population, we assume that
     25 <img src="Hypothesis%20testing.resources/B2717D7E-C672-4C00-B996-39660928F65A.png" height="10" width="46"/>.</div></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">test statistic:</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     26 <img src="Hypothesis%20testing.resources/8E7AA75B-D32B-4AAF-B0B0-E56A570B091D.png" height="53" width="206"/></span></div><div style="-en-paragraph:true;"><span style="font-size: 16px;"><br/></span></div><div style="-en-paragraph:true;">the pooled sample variance is:</div><div style="-en-paragraph:true;"><span style="font-size: 16px;"><br/></span></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     27 <img src="Hypothesis%20testing.resources/263C0E18-D9DB-4CB0-BB4A-43F1827F4108.png" height="40" width="200"/></span></div><div style="-en-paragraph:true;"><span style="font-weight: bold;"><br/></span></div><div style="-en-paragraph:true;"><span style="font-weight: bold;">Not assuming equal σ</span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">test statistic:</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     28 <img src="Hypothesis%20testing.resources/2B02CEB6-9584-4118-9A46-205A09FC1DB9.png" height="53" width="198"/></span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">which under null hypothesis has t-distribution with
     29 <img src="Hypothesis%20testing.resources/B1078169-092F-4C44-85A6-DB841B1886D8.png" height="10" width="8"/> degrees of freedom.
     30 <img src="Hypothesis%20testing.resources/B1078169-092F-4C44-85A6-DB841B1886D8.png" height="10" width="8"/> at the exam is the smallest of the two sample sizes.</div><div style="-en-paragraph:true;"><br/></div><h2>Two proportions</h2><div style="-en-paragraph:true;">H0: p<sub>1</sub> = p<sub>2</sub></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">test statistic:</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     31 <img src="Hypothesis%20testing.resources/D3588BEF-39B7-40E6-BF7F-64884EA6BB58.png" height="53" width="160"/></span></div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">(1−α) CI for p<sub>1</sub>−p<sub>2</sub>:</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;">
     32 <img src="Hypothesis%20testing.resources/B9EA8A3D-3510-4F48-A8D2-119684783B2D.png" height="16" width="82"/> where</div><div style="-en-paragraph:true;"><br/></div><div style="-en-paragraph:true;"><span style="font-size: 16px;">
     33 <img src="Hypothesis%20testing.resources/F36A9926-CAC5-4B8F-891A-B311A4D065E3.png" height="50" width="266"/></span></div></body></html>