Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-5)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
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!
Answers to the exercises are available here.
Exercise 1
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.
- Which probability function should be used to compute the number of failing engine in a QA test if the failure rate is 1%?
- What is the probability that a windows work correctly during the QA test?
- What is the probability that no windows breaks during the test?
- What is the probability that up to 3 windows breaks during the test?
- Simulate this process to estimate the average amount of engine failure during the test
Exercise 2
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 dataset. Find the 90% confidence interval for the mean of this dataset.
Exercise 3
The MNIST database 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:
- What is the probability that this algorithm doesn’t recognize 4 digits?
- What is the probability that this algorithm doesn’t recognize 6 or 7 digits?
- What is the probability that this algorithm doesn’t recognize 3 digits or less?
- If we use this algorithm on a set of 3000 digits, what is the probability that it fails more than 10 times?
Exercise 4
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:
- What is the chance that the fourth traveler who is checked has a forbidden item in his luggage?
- What is the probability that the first traveler caught with forbidden item is caught before the fourth traveler?
Exercise 5
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.
- 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.
- Use bootstrapping to compute the proportion of positive answer that is smaller than 95% of the other possible proportion.
- What is the percentage of bootstrapped proportion smaller than 70%?
- As a consequence of your last answer, what the start-up should do?
Exercise 6
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:
- Simulate the work of both candidates by generating 200 points of data from both distributions.
- Use bootstrapping to compute the 95% confidence interval for both means.
- Can we conclude that a candidate is faster than the other?
Exercise 7
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?
Exercise 8
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 here)
Exercise 9
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 dataset where the numbers are in millions.
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:
- Compute the mean.
- Compute the variance.
- Compute the quartile.
- Compute the range which is define by the maximum value minus the minimum value.
Exercise 10
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?
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.