{"id":120,"date":"2018-03-27T06:55:00","date_gmt":"2018-03-27T04:55:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/2018\/03\/27\/what-is-run-test-in-statistics-a-simple-explanation-with-step-by-step-examples\/"},"modified":"2020-08-22T20:27:14","modified_gmt":"2020-08-22T18:27:14","slug":"what-is-run-test-in-statistics-a-simple-explanation-with-step-by-step-examples","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/what-is-run-test-in-statistics-a-simple-explanation-with-step-by-step-examples\/","title":{"rendered":"What is Run Test in Statistics &#8211; A Simple Explanation with Step by Step Examples"},"content":{"rendered":"<p>The Run Test is actually one of the most interesting statistical test ever and it is so easy to understand, or even the easiest. Remember that if you have any difficulty following this lesson, let me know in the comment box below. \ud83d\udc47\ud83d\udc47\ud83d\udc47 I would clearify<\/p>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<p>In this simple lesson, we are going to explain in very simple and clear terms, the concept of run test in statiscs<\/p>\n<p><b>Content<\/b><\/p>\n<ol>\n<li><a href=\"https:\/\/www.kindsonthegenius.com\/blog\/what-is-run-test-in-statistics-a-simple-explanation-with-step-by-step-examples#t1\">What is\u00a0 Run Test?<\/a><\/li>\n<li><a href=\"https:\/\/www.kindsonthegenius.com\/blog\/what-is-run-test-in-statistics-a-simple-explanation-with-step-by-step-examples#t2\">What is a Run?<\/a><\/li>\n<li><a href=\"#t3\">Example of Runs\u00a0<\/a><\/li>\n<li><a href=\"#t4\">Run Test Procedure<\/a>\n<ul>\n<li>Hypothesis<\/li>\n<li>Test Statistic and Decision Rule<\/li>\n<li>Critical Value<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#t5\">Example 1 and Solution<\/a><\/li>\n<li><a href=\"#t6\">Example 2 and Solution<\/a><\/li>\n<li><a href=\"#t7\">Example 3 and Solution<\/a><\/li>\n<li><a href=\"#t8\">Solving With Formular for large samples\u00a0<\/a><\/li>\n<li><a href=\"#t9\">Final Notes<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h3 id=\"t1\">1. What is Run Test<\/h3>\n<p>Run test is a statistical test used to determine of the data obtained from a sample is ramdom. That is why it is called Run Test for Randomness.<br \/>\nRandomness of the data is determined based on the number and nauture of runs present in the data of interest.<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t2\">2. What is a Run?<\/h3>\n<p>A run is a sequence of similar or like events, items or symbols that is preceded by and followed by an event, item or symbol of a different type,\u00a0 or by none at all.<br \/>\nRandomness of of the series\u00a0 is unlikely when there appear to be either too many or two few runs. In this case, a run test need to be carried out to determine the randomness.<br \/>\nThe Run Test when performed helps us to decide whether a sequence of events, items or symbol is the result of a random process.<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t1\">3. Example of Runs<\/h3>\n<p>A data scientist carrying out a research interviewed 10 persons during a survey. We denote the genders of the poeple by M for men and W for women.<br \/>\nAssuming the respondents were chosen as follows:<\/p>\n<p><i>Scenario 1<\/i><br \/>\nM M M M M F F F F F<\/p>\n<p>Scenario 2<br \/>\nF M F M F M F M F M<\/p>\n<p>Scenario 3<br \/>\nF F F M M F M M F F<\/p>\n<p>Scenario 1 has only 2 runs and therefore the scenario cannot be considered random because there are to few runs<\/p>\n<p>Scenario 2 has too many runs, 5 runs. And therefore would not be considered as random<\/p>\n<p>Scenario 3 has 5 runs and therefore we need to perform a test to determine the randomness of the data.<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t4\">4. Run Test Procedure<\/h3>\n<p>First we need to assume that the data available for the analysis consistes of a sequence of observations, recorded in order of occurence, which we can categorize into two mutually exclusive types.<\/p>\n<p>First, you need to determine the total sample size, then the number of observation ofeach type as presented below:<\/p>\n<p>n = total sample size<br \/>\nn<sub>1<\/sub> = the number of observation of one type<br \/>\nn<sub>2<\/sub> = the number of observations of the other type<\/p>\n<p><b>Hypothesis <\/b><br \/>\nThen State the null and alternate hypothesis<\/p>\n<p>A. TWO-SIDED<br \/>\nH<sub>0<\/sub>: the pattern of occurence is random<br \/>\nH<sub>1<\/sub>: the pattern of occurence is not random<\/p>\n<p>B. ONE-SIDED<br \/>\nH<sub>0<\/sub>: the pattern of occurence is random<br \/>\nH<sub>1<\/sub>: the pattern of occurence is not random (because there are too few runs to be atributed as random)<\/p>\n<p>C. ONE-SIDED<br \/>\nH<sub>0<\/sub>: the pattern of occurence is random<br \/>\nH<sub>1<\/sub>: the pattern of occurence is not random (because there are too few runs to be atributed as random)<\/p>\n<p><b>Test Statistic and Decision Rule<\/b><br \/>\nThe test statistic is r = total number of runs<br \/>\nThe decision rules is also called the acceptance or rejection criteria. It depends on the test statistic(calculated) and the value and the values of upper and lower limits(from statistical tables)<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-8U7dFbD6dMs\/WrlbemhIihI\/AAAAAAAABmQ\/SXhcRcX8HEsMDMtgz6p9b1mHdUwWIJQFACLcBGAs\/s1600\/Run%2BTest.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/3.bp.blogspot.com\/-8U7dFbD6dMs\/WrlbemhIihI\/AAAAAAAABmQ\/SXhcRcX8HEsMDMtgz6p9b1mHdUwWIJQFACLcBGAs\/s640\/Run%2BTest.jpg\" width=\"640\" height=\"286\" border=\"0\" data-original-height=\"445\" data-original-width=\"987\" \/><\/a><\/div>\n<div style=\"clear: both; text-align: center;\">Table 1: Decision Rule<\/div>\n<p><b>Critical Value<\/b><br \/>\nCritical value is determined from statistical table using n<sub>1<\/sub> and n<sub>2<\/sub><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\n<span style=\"color: red;\">We can solve some examples to clarify this.<\/span><span style=\"color: red;\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t5\">5. Example 1<\/h3>\n<p>On a commuter train, the conductor want to see whether the passengers entering a train enter in a random manner. He observes the first 25 people, with the following sequence of males(M) and females(F).<\/p>\n<p>F F F M M F F F F M F M M M F F F F M M F F F M M<\/p>\n<p>Test for randomness at <span style=\"background-color: white; color: #222222; display: inline; float: none; font-family: 'arial' , sans-serif; font-size: x-small; font-style: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;\">\u03b1 <\/span>= 0.05<\/p>\n<p><span style=\"color: #38761d;\"><b>Solution Steps<\/b><\/span><br \/>\n<b>Step 1<\/b>: State the null and alternate hypothesis<br \/>\nH<sub>0<\/sub>: The patter of occurence of males and females enter the train is random<br \/>\nH<sub>1<\/sub>: The pattern of occurence of males and females entering the train is not random<\/p>\n<p><b>Step 2:<\/b> Find the test statistic (number of runs)<br \/>\nYou can easily get this by grouping each run as shown below:<\/p>\n<p><span style=\"color: #cc0000;\">FFF\u00a0 <\/span>MM \u00a0 <span style=\"color: #cc0000;\">FFFF \u00a0 <\/span>M\u00a0\u00a0 <span style=\"color: #cc0000;\">F \u00a0 <\/span>MMM\u00a0\u00a0 <span style=\"color: #cc0000;\">FFFF\u00a0\u00a0 <\/span>MM\u00a0\u00a0 <span style=\"color: #cc0000;\">FFF\u00a0\u00a0 <\/span>MM<\/p>\n<p>Test statistic, r = 10<br \/>\nn<sub>1<\/sub> = number of females = 15<br \/>\nn<sub>2<\/sub> = number of males = 10<\/p>\n<p><b>Step 3:<\/b> Find the critical value<br \/>\nWe can find the lower and upper critical value from statistical run table<br \/>\nn<sub>1<\/sub> = 15, n<sub>2<\/sub> = 10<br \/>\nLower critical value = 7<br \/>\nUpper critical value = 18<\/p>\n<p><b>Step 4: <\/b>Make your decision<br \/>\nSince r = 10 which is between 7 and 18, we accept the null hypothesis (we fail to reject it)<\/p>\n<p><b>Step 5:<\/b> Draw a Conclusion<br \/>\nThere are not enough evidence to reject the claim hat the pattern of occurence of males and femals enter the train is determined by a random process<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t6\">6. Example 2<\/h3>\n<p>We have 20 people that enrolled in a drug abuse program. Test the claim that the ages of the people, according to the order in whihc they enroll occur at random, at <span style=\"background-color: white; color: #222222; display: inline; float: none; font-family: 'arial' , sans-serif; font-size: x-small; font-style: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;\">\u03b1 <\/span>= 0.05.<\/p>\n<p>The data are as follows:<br \/>\n18, 36, 19, 22, 25, 44, 23, 27, 27, 35, 19, 43, 37, 32, 28, 43, 46, 19, 20, 22<\/p>\n<p><span style=\"color: #274e13;\"><b>Solution Steps<\/b><\/span><br \/>\n<b>Step 1:<\/b> State the hypothesis and identify the claim<\/p>\n<p>The claim is the null hypothesis H<sub>0<\/sub> and the hypothesis is the alternate hypothesis H<sub>1<\/sub>.<br \/>\nH<sub>0<\/sub>: The pattern of occurence of ages of the people enrolled in a drug abuse program is determined by a random process<br \/>\nH<sub>1<\/sub>: The pattern of occurence ofa ages of people enrolled in a drug abuse program is not random<\/p>\n<p><b>Step 2:<\/b> Find the test statistic (number of runs)<br \/>\nTo find the number of runs we first arrange the data\u00a0 in ascending order and find the median of the data set.<\/p>\n<p>Then compare the original data with the median. The replace the above median in the original sequence with an A if it is above the median and with B if it is below the median.(you can also use the mean instead of median)<br \/>\nI have done this using excel and the result is shown below:<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/1.bp.blogspot.com\/-bg3fO3xBZkQ\/WrloK2oDa-I\/AAAAAAAABmg\/VF-xs6SkqVA4hS9hiJCYUzn-Hud0DV8gwCLcBGAs\/s1600\/Run%2BTest%2BExample%2B2.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/1.bp.blogspot.com\/-bg3fO3xBZkQ\/WrloK2oDa-I\/AAAAAAAABmg\/VF-xs6SkqVA4hS9hiJCYUzn-Hud0DV8gwCLcBGAs\/s640\/Run%2BTest%2BExample%2B2.jpg\" width=\"640\" height=\"67\" border=\"0\" data-original-height=\"130\" data-original-width=\"1208\" \/><\/a><\/div>\n<p>We can now arrange the data according to runs and we would have the output below:<br \/>\n<span style=\"color: #cc0000;\">B<\/span>\u00a0 A\u00a0 <span style=\"color: #cc0000;\">BBB \u00a0 <\/span>A\u00a0 <span style=\"color: #cc0000;\">B<\/span>\u00a0 A\u00a0 <span style=\"color: #cc0000;\">B<\/span>\u00a0 AAAAAA \u00a0 <span style=\"color: #cc0000;\">BBB<\/span><\/p>\n<p>From the above\u00a0 we have<\/p>\n<p>Test statistic, r = 9<br \/>\nn<sub>1<\/sub> = number or A runs = 9<br \/>\nn<sub>2<\/sub> = number of B runs =9<\/p>\n<p><b>Step 3:<\/b> Find the Critical Value<br \/>\nn<sub>1<\/sub> = 9, n<sub>2<\/sub> = 9<br \/>\nFrom statistical table of Runs Test, we get the critical values<\/p>\n<p>Upper critical value = 5<br \/>\nLower critical value =15<\/p>\n<p><b>Step 4:<\/b> Make the decision<br \/>\nSince the statistic r is between the upper and lower critical values, we accept H<sub>0<\/sub><\/p>\n<p><b>Step 5<\/b>: Draw your conclusion<br \/>\nThere is not enough evidence to reject the claim that the patter of occurence of ages of people in th program is determined by a random process<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t7\">7. Example 3:<\/h3>\n<p>Table 1.0 shows the departures from normal of daily temperatures recorded at Atlanta, Georgia during February1969. We would like to know whether we may conclude that the pattern of departures above and below normal is the result of a non-random process.<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-hcxcuIbyvjM\/WrlwJDdObQI\/AAAAAAAABmw\/MbcNlMEqw4A5LRcftz4l5PHRwYwz4nbgwCLcBGAs\/s1600\/Run%2BTest%2BExample%2B3.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/3.bp.blogspot.com\/-hcxcuIbyvjM\/WrlwJDdObQI\/AAAAAAAABmw\/MbcNlMEqw4A5LRcftz4l5PHRwYwz4nbgwCLcBGAs\/s400\/Run%2BTest%2BExample%2B3.jpg\" width=\"400\" height=\"390\" border=\"0\" data-original-height=\"636\" data-original-width=\"652\" \/><\/a><\/div>\n<p><span style=\"color: #274e13;\"><b>Solution Steps <\/b><\/span><\/p>\n<p><b>Step 1:<\/b> State the null and the alternate hypothesis<br \/>\nH<sub>0<\/sub>: The pattern of occurence of negative and positive deviations from normal is determined by a random process<br \/>\nH<sub>1<\/sub>: The pattern of occurrences of negative and positive deviations from normal is not determined by a random process (claim)<\/p>\n<p><b>Step 2: <\/b>Find the test statistics (number of runs)<br \/>\nTo get the number of runs, we need to find the departures from normal above and below zero. The departures from normal that is above 0 are recorded as A and those that are below 0 are recorded as B.<br \/>\nIf we do this we would have the arrangement as follows:<\/p>\n<p>AAAAAA <span style=\"color: #990000;\">B<\/span> A <span style=\"color: #cc0000;\">B<\/span> AA <span style=\"color: #cc0000;\">BBBBB <\/span>AAAAAAAA <span style=\"color: #cc0000;\">BBBBBB<\/span><\/p>\n<p>Test Statistic (number of runs) r = 8<br \/>\nn<sub>1<\/sub> = number of A = 17<br \/>\nn<sub>2<\/sub> = number of B = 13<\/p>\n<p><b>Step 3: <\/b>Find the critical value<br \/>\nn<sub>1<\/sub> = 17, n<sub>2<\/sub> = 13<\/p>\n<p>Using statistical table\u00a0 we find the:<br \/>\nLower critcal value = 10<br \/>\nUpper critical value = 22<\/p>\n<p><b>Step 4<\/b>: Make the decision<br \/>\nSince r = 8, which is lower than the critical value, we reject the null hypothesis (H<sub>0<\/sub>)<\/p>\n<p><b>Step 5: <\/b>Draw the conclusion<br \/>\nThere is enough evidence to support the claim that the pattern of occurence of positive and negative departures from normal is not random<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t8\">8. Formular for Large Samples<\/h3>\n<p>What if the sample size is large? In this case we could use a formula to solve it. This formular calculates the the test statistic based on n<sub>1<\/sub> and n<sub>2<\/sub>.<br \/>\nThe formula is given by:<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/1.bp.blogspot.com\/-jeQjE04v7v0\/Wrng6Y9QQNI\/AAAAAAAABnA\/Q8A3-T4O4s8TaTyzOVCmje8jFPscMdIkACLcBGAs\/s1600\/Run-Test-Formular.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/1.bp.blogspot.com\/-jeQjE04v7v0\/Wrng6Y9QQNI\/AAAAAAAABnA\/Q8A3-T4O4s8TaTyzOVCmje8jFPscMdIkACLcBGAs\/s320\/Run-Test-Formular.jpg\" width=\"320\" height=\"90\" border=\"0\" data-original-height=\"200\" data-original-width=\"710\" \/><\/a><\/div>\n<p>Then we can look up the critical value in the table of normal distribution<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t9\">9. Final Notes<\/h3>\n<p>Now that you have completed the lessons on run tests. Thumbs up to you! One thing you can be sure is it does not get more complicated than this.<br \/>\nJust a a quiz, try to solve the three examples using the formula presented and compare the result you have with the result gotten without using the formula<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Run Test is actually one of the most interesting statistical test ever and it is so easy to understand, or even the easiest. Remember &hellip; <\/p>\n","protected":false},"author":2,"featured_media":742,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[223],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/120"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":6,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"predecessor-version":[{"id":1256,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/120\/revisions\/1256"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media\/742"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}