<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/hacking-statistics-or-how-i-learned-to-stop-worrying-about-calculus-and-love-stats-exercises-part-5/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.r-exercises.com/2017/08/01/hacking-statistics-exercises-part-5/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-statistics-exercises-part-5"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="https://i2.wp.com/www.r-exercises.com/wp-content/uploads/2017/07/HS_part4-7.png" target="_blank"><img sizes="(max-width: 150px) 100vw, 150px" src="https://i2.wp.com/www.r-exercises.com/wp-content/uploads/2017/07/HS_part4-7-150x150.png?resize=150%2C150" alt="" class="wp-image-7168" data-recalc-dims="1"></a>Statistics are often taught in school by and for people who like Mathematics. As a consequence, in those class emphasis is put on leaning equations, solving calculus problems and creating mathematics models instead of building an intuition for probabilistic problems. But, if you read this, you know a bit of R programming and have access to a computer that is really good at computing stuff! So let’s learn how we can tackle useful statistic problems by writing simple R query and how to think in probabilistic terms.</p>
<p>In today’s set you will have to use the stuff you’ve seen in the first fourth installment of this series of exercise set, but in a more practical setting. Take this as a fun test before we start learning cool stuff like A/B testing, conditional probability and the Bayes theorem. I hope you will enjoy doing it!</p>
<p>Answers to the exercises are available <a rel="nofollow" href="http://www.r-exercises.com/2017/08/01/hacking-statistics-solutions-part-5/" target="_blank">here</a>.</p>
<p><strong>Exercise 1</strong><br>
A company makes windows who should be able to withstand wind of 120 km/h. The quality assurance department of that company has for mandate to make sure that the failure rate of those windows is less than 1% for each batch of windows produced by their factory. To do so, they choose randomly 10 windows per batch of 150 and place them in a wind tunnel where they are tested.</p>
<ol>
<li>Which probability function should be used to compute the number of failing engine in a QA test if the failure rate is 1%?</li>
<li>What is the probability that a windows work correctly during the QA test?</li>
<li>What is the probability that no windows breaks during the test?</li>
<li>What is the probability that up to 3 windows breaks during the test?</li>
<li>Simulate this process to estimate the average amount of engine failure during the test</li>
</ol>
<p><strong>Exercise 2</strong><br>
A team of biologist is interested in a type of bacteria who seems to be resistant to extreme change to their environment. In a particular study they put a culture of bacteria in an acidic solution, observed how many days 250 individual bacteria would survive and created this <a rel="nofollow" href="http://www.r-exercises.com/wp-content/uploads/2017/07/data.ex_.10.csv" target="_blank">dataset</a>. Find the 90% confidence interval for the mean of this dataset.</p>
<p><strong>Exercise 3</strong><br>
The <a rel="nofollow" href="https://en.wikipedia.org/wiki/MNIST_database#Performance" target="_blank">MNIST database</a> is a large dataset of handwritten digits used by data scientist and computer science experts as a reference to test and compare the effectiveness of different machine learning and computer vision algorithms. If a state of the art algorithm can identify the handwritten digits in this dataset 99,79% of the time and we use this algorithm on a set of 1000 digits:</p>
<ol>
<li>What is the probability that this algorithm doesn’t recognize 4 digits?</li>
<li>What is the probability that this algorithm doesn’t recognize 6 or 7 digits?</li>
<li>What is the probability that this algorithm doesn’t recognize 3 digits or less?</li>
<li>If we use this algorithm on a set of 3000 digits, what is the probability that it fails more than 10 times?</li>
</ol>
<p><strong>Exercise 4</strong><br>
A custom officer in an airport as to check the luggage of every passenger that goes through custom. If 5% of all passenger travels with forbidden substances or objects:</p>
<ol>
<li>What is the chance that the fourth traveler who is checked has a forbidden item in his luggage?</li>
<li>What is the probability that the first traveler caught with forbidden item is caught before the fourth traveler?</li>
</ol>
<div>
<aside><img src="http://www.r-exercises.com/2017/08/01/hacking-statistics-exercises-part-5/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-statistics-exercises-part-5"></aside>
<div><strong>Learn more</strong> about probability functions in the online course <a rel="nofollow" href="http://www.r-exercises.com/product/statistics-with-r-advanced-level/" target="_blank">Statistics with R – Advanced Level</a>. In this course you will learn how to:
<ul>
<li>Work with about different binomial and logistic regression techniques</li>
<li>Know how to compare regression models and choose the right fit</li>
<li>And much more</li>
</ul>
</div>
</div>
<p><strong>Exercise 5</strong><br>
A start-up want to know if their marketing push in a specific market has been successful. To do so, they interview 1000 people in a survey and ask them if they know their product. Of that number, 710 where able to identify or name their product. Since the start-up has limited resource, they decided that they would reallocate half the marketing budget to their data science department if more than 70% of the market knew about their product.</p>
<ol>
<li>Simulate the result of the survey by creating a matrix containing 710 ones representing the positive response and 290 zeros representing the negative response to the survey.</li>
<li>Use bootstrapping to compute the proportion of positive answer that is smaller than 95% of the other possible proportion.</li>
<li>What is the percentage of bootstrapped proportion smaller than 70%?</li>
<li>As a consequence of your last answer, what the start-up should do?</li>
</ol>
<p><strong>Exercise 6</strong><br>
A data entry position need to be filed at a tech company. After doing the interview process, human resource selected the two ideal candidate to do a final test where they had to complete a sample day of work (they take data entry really seriously in this company). The first candidate did his work with an average time of 5 minutes for each form and a variance of 35 minutes while the second did it with a mean of 6.5 minutes and a variance of 25. Assuming that the time needed by an employer to fill in a form follow a normal distribution:</p>
<ol>
<li>Simulate the work of both candidates by generating 200 points of data from both distributions.</li>
<li>Use bootstrapping to compute the 95% confidence interval for both means.</li>
<li>Can we conclude that a candidate is faster than the other?</li>
</ol>
<p><strong>Exercise 7</strong><br>
A business wants to launch a product in a new market. Their study show that to be viable a market must be composed of at least 60% of potential consumer making more than 35 000$. If the last census show that the salary of this population follow an exponential distribution with a mean of 60000 and that the rate of an exponential distribution is equal to 1/mean, should this business launch their product in this market?</p>
<p><strong>Exercise 8</strong><br>
A batch of 1000 ohms resistance are scheduled to be solder to two other 200 ohms resistance to create a serial circuit of 1400 ohms. But no manufacturing process is perfect and no resistance has perfectly the value it supposed to have. Suppose that the first resistance is made following a normal process that makes batch of resistance with a mean of 998 ohms and a standard deviation of 5.2 ohms, while the two other come from another process who produce batch of resistance with a mean of 202 and a variance of 2.25. What is the percentage of circuits will have for resistance a value in the interval [1385,1415]? (Note: you can use bootstrap to solve this problem or you can use the fact that the sum of two normal distributions is equal to another normal distribution whose mean is equal to the sum of their two means. The variance the new distribution is calculated the same way. You can learn more <a rel="nofollow" href="https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables" target="_blank">here</a>)</p>
<p><strong>Exercise 9</strong><br>
A probiotic supplement company claim that three kinds of bacteria are present in equal part in each of their pill. An independent laboratory is hired to test if this company respects this claim. After taking a small sample of five pills, they get the following <a rel="nofollow" href="http://www.r-exercises.com/wp-content/uploads/2017/07/data.ex_.8.csv" target="_blank">dataset</a> where the numbers are in millions.</p>
<p>In this dataset, the rows represent pills used in the sample and each column represents a different kind of bacteria. For each kind of bacteria:</p>
<ol>
<li>Compute the mean. </li>
<li>Compute the variance.</li>
<li>Compute the quartile.</li>
<li>Compute the range which is define by the maximum value minus the minimum value.</li>
</ol>
<p><strong>Exercise 10</strong><br>
A shipping company estimate that the delivery delays of his shipment, in hours, follow a student distribution with a parameter of 6. What is the proportion of delivery that are between 1 hours late and 3 hours late?</p>
<div>
<h3>Related exercise sets:</h3>
<ol>
<li><a rel="nofollow" href="http://www.r-exercises.com/2016/11/20/nonparametric-tests/" title="Nonparametric Tests Exercises" target="_blank">Nonparametric Tests Exercises </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/2017/07/08/hacking-statistics-exercises-part-2/" title="Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-2)" target="_blank">Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-2) </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/2017/07/18/hacking-statistics-exercises-part-3/" title="Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-3)" target="_blank">Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-3) </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/start-here-to-learn-r/" target="_blank">Explore all our (>1000) R exercises</a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/r-courses/" target="_blank">Find an R course using our R Course Finder</a> directory</li>
</ol>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.r-exercises.com/2017/08/01/hacking-statistics-exercises-part-5/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-statistics-exercises-part-5"> R-exercises</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/tCUJ8scCPaY" height="1"></a></div>