Assignment: Analyzing Binary Data

OUTLINE

Assignment: Analyzing Binary Data

 

Don't use plagiarized sources. Get Your Custom Essay on
Assignment: Analyzing Binary Data
Just from $13/Page
Order Essay
Part 1: Flipping Coins

In this part of the assignment, you will be simulating flipping a coin to get either heads or tails.

This requires using the statistical program R. Please go to https://www.r-project.org/ and follow the instructions for downloading and installing R.

This also requires an understanding of the probabilities for coin flipping. If you flip a fair coin one time, there are two possible outcomes: heads or tails. This can also be looked at as 1 head or 0 heads. The probability of 1 head is 50%. The probability of 0 heads is 50%. The binomial distribution with p=0.5 describes this coin flipping.

If you flip a fair coin three times, there are eight possible outcomes: HHH, HHT, HTH, HTT, THH, THT, TTH, or TTT. This can also be looked at as 0 heads, 1 head, 2 heads, or 3 heads. These can be presented as a probability table: (table shown above)

Number of Heads Probability
0  
1  
2  
3  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1-1) Give the probability table for the number of heads for four flips of a fair coin.

1-2) In R, develop code that will flip a coin four times and count how many times heads occurs. Then, add a loop to the code so that this process is repeated 100 times, storing whether there were 0, 1, 2, 3, or 4 heads for each of 100 trials. There are multiple ways to do this, and it is okay if you use R code that you find shared from other sources. It is likely that you will need the stats package downloaded to your computer and loaded in R (https://www.rdocumentation.org/packages/stats), as this provides the functionality for Binomial and other simulations.

  1. Provide the R code you used for the coin flip trials.
  2. Use R to count how many of the 100 trials had 0 heads, how many had 1 head, how many had 2 heads, how many had 3 heads, and how many had 4 heads. Give these counts and discuss how these results compare to your theoretical table for flipping a coin four times.

1-3) If a coin was flipped 10 times, what is the expected probability of getting:

  1. exactly 7 heads?
  2. 7 or fewer heads?
  3. fewer than 7 heads?
  4. 7 or more heads?
  5. more than 7 heads?

1-4) Develop R code to do 10,000 trials in which a fair coin is flipped 10 times in each trial tallying the number of heads for each trial. Record how many of the trials met each of the following conditions:

  1. exactly 7 heads
  2. 7 or fewer heads
  3. fewer than 7 heads
  4. 7 or more heads
  5. more than 7 heads

1-5) Compare your results for the 10,000 simulated trials with your expected values for 10 flips in the two previous questions. Discuss.

1-6) Use R to create a histogram for the total number of heads in each of the 10,000 trials for 10 flips of a fair coin.

1-7) Use R to create three additional histograms for 10,000 trials for each of these cases:

  1. 4 flips of a fair coin
  2. 25 flips of a fair coin
  3. 100 flips of a fair coin

1-8) Describe how the distribution in the histogram changes for 4 flips to 10 flips to 25 flips to 100 flips. Consider a shared x-axis representing the probability of getting heads rather than total counts to facilitate this comparison. Include the Central Limit Theorem in your explanation for these changes.

1-9) The binomial distribution also applies to other event probabilities. An online store offers a coupon that is used by 10% of customers. Produce histograms for the number of coupons used by 4 customers, by 10 customers, by 25 customers, and by 100 customers. Compare these histograms including the central limit theorem in your discussion, and compare with your previous histograms where the probability was 50% including the central tendency in your discussion.

Part 2: Purchasing OJ

In this part of the assignment, you will be working with Boolean variables from the OJ data set in the ISLR package (https://cran.r-project.org/web/packages/ISLR). You will also be using the stats package (https://www.rdocumentation.org/packages/stats) and the irr package (https://cran.r-project.org/web/packages/irr).

The OJ data set provides information similar to what might be available to any distributor regarding product performance at various retail locations. The purchases of Citrus Hill and Minute Maid are tracked along with information on prices, sales, store, and other factors. This assignment explores Boolean aspects of this data to answer questions about the performance of Citrus Hill.

2-1) Transform the variable Purchase, which lists either CH for Citrus Hill or MM for Minute Maid, into a new indicator variable for which the value is 1 if Citrus Hill is purchased and 0 if it is not. Provide your R code for the transformation.

2-2) Characterize the purchase rate of Citrus Hill by calculating each of the following and explaining what the result tells you about Citrus Hill purchasing:

  1. 95% confidence interval for the mean
  2. odds
  3. log-odds

2-3) Choose one of the following questions from the options below. Use the listed statistical techniques for analysis, and describe result. In your results, you should describe the statistical technique, explain how it relates to the question including aligned hypotheses, and give a statistically supported answer to the question.

  • Option 1) Are customers more likely to buy Citrus Hill if there is a special offered on it? (odds ratio, McNemar Test)
  • Option 2) Is cheaper price a good predictor for what someone will buy? (agreement co-efficient)
  • Option 3) Does Store7 price Citrus Hill higher than other stores? (t-test)
  • Option 4) How well can you predict percent sales of Citrus Hill at a store if you know the prices, specials, and discounts for both orange juice brands at that store? (logistic regression)

 

 

 

Sources to be used for citation and reference: Sources to be used for citation and reference:

The R Foundation. (n.d.). The R project for statistical computing. Retrieved December 9, 2017, from https://www.r-project.org/

Package ‘ISLR’. (2017). Retrieved from https://cran.r-project.org/web/packages/ISLR/ISLR.pdf

RDocumentation. (n.d.). The R stats package. Retrieved December 9, 2017, from https://www.rdocumentation.org/packages/stats

Package ‘irr’. (2015). Retrieved from https://cran.r-project.org/web/packages/irr/irr.pdf

Verzani, J. (2001). simpleR – Using R for introductory statistics.

 

James, G., Witten, D., Hastie, T., & Tibshirani, R. (2013). An introduction to statistical learning: With applications in R. New York, NY: Springer. Retrieved from http://www-bcf.usc.edu/~gareth/ISL/ISLR%20Seventh%20Printing.pdf

Kabacoff, R. I. (2017). R tutorial. Retrieved from https://www.statmethods.net/r-tutorial/index.html

 

 

Grading Rubric:

Element 1: Probability Table for Four Flips of a Fair Coin (1-1)–

Mastery Criteria 3.2 (8%) points

Student provides an accurately constructed probability table for the number of heads for four flips of a fair coin. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student provides a probability table for the number of heads for four flips of a fair coin. There is a minor error in the calculation that results in the wrong probability percentage, but student uses the correct formula format.

Competent Criteria 2.72 (6.8%) points

Student provides a probability table for the number of heads for four flips of a fair coin. There is an error in the calculation that results in the wrong probability percentage due to a step missing in the calculations and/or the formula being applied incorrectly.

Developing Criteria 2.4 (6%) points

Student provides an incomplete probability table that does not demonstrate an understanding of how to apply the formula to determine the probability for the number of heads for four flips of a fair coin.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 2: R Code used for Coin Flip Trials (1-2)–

Mastery Criteria 3.2 (8%) points

Student provides an accurate R code used for the coin flip trials, correctly identifying how many of the 100 trials had 0 heads, 1 head, 2 heads, 3 heads, and 4 heads; and provides a thorough and detailed explanation of how these results compared to his/her theoretical table for flipping a coin four times. There are no errors/details missing.

Exceptional Criteria 2.98 (7.44%) points

Student provides an accurate R code used for the coin flip trials, correctly identifying how many of the 100 trials had 0 heads, 1 head, 2 heads, 3 heads, and 4 heads; and provides a detailed explanation of how these results compared to his/her theoretical table for flipping a coin four times. There are one or two minor errors/details missing.

Competent Criteria 2.72 (6.8%) points

Student provides the R code used for the coin flip trials, identifying how many of the 100 trials had 0 heads, 1 head, 2 heads, 3 heads, and 4 heads; and provides an explanation of how these results compared to his/her theoretical table for flipping a coin four times. Some details are missing and/or lack clarity.

Developing Criteria 2.4 (6%) points

Student provides the R code used for the coin flip trials, incorrectly identifying how many of the 100 trials had 0 heads, 1 head, 2 heads, 3 heads, and 4 heads and/or provides a cursory or incomplete explanation with vague or missing details of how these results compared to his/her theoretical table for flipping a coin four times.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 3: Coin Flipped 10 Times (1-3)–

Mastery Criteria 3.2 (8%) points

Student accurately identifies the expected probability of getting exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student accurately identifies the expected probability of getting exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are one or two minor errors.

Competent Criteria 2.72 (6.8%) points

Student identifies the expected probability of getting exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are some errors.

Developing Criteria 2.4 (6%) points

Student identifies the expected probability of getting exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are many errors.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory assessment that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 4: R Code for 10,000 Trials of Flipping a Fair Coin Ten Times (1-4)–

Mastery Criteria 3.2 (8%) points

Student accurately identifies how many of the trials met each of the following conditions: exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student accurately identifies how many of the trials met each of the following conditions: exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are one or two minor errors.

Competent Criteria 2.72 (6.8%) points

Student identifies how many of the trials met each of the following conditions: exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are some errors.

Developing Criteria 2.4 (6%) points

Student identifies how many of the trials met each of the following conditions: exactly 7 heads, 7 or fewer heads, fewer than 7 heads, 7 or more heads, and more than 7 heads. There are many errors.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory assessment that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 5: Comparison of Simulated Trials with Expected Values (1-5)–

Mastery Criteria 3.2 (8%) points

Student provides a thorough and detailed comparison of his/her results for the 10,000 simulated trials with his/her expected values for 10 flips in the Element 3 and 4.

Exceptional Criteria 2.98 (7.44%) points

Student provides a detailed comparison of his/her results for the 10,000 simulated trials with his/her expected values for 10 flips in the Element 3 and 4. There are one or two minor details missing.

Competent Criteria 2.72 (6.8%) points

Student provides a comparison with some details of his/her results for the 10,000 simulated trials with his/her expected values for 10 flips in the Element 3 and 4. Some details are missing and/or lack clarity.

Developing Criteria 2.4 (6%) points

Student provides a cursory or incomplete comparison with vague or missing details of his/her results for the 10,000 simulated trials with his/her expected values for 10 flips in the Element 3 and 4. Most details are missing.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 6: Histogram (1-6)–

Mastery Criteria 3.2 (8%) points

Student accurately uses R to construct a histogram for the total number of heads in each of the 10,000 trials for 10 flips of a fair coin. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student accurately uses R to construct a histogram for the total number of heads in each of the 10,000 trials for 10 flips of a fair coin. There are one or two minor errors.

Competent Criteria 2.72 (6.8%) points

Student uses R to construct a histogram for the total number of heads in each of the 10,000 trials for 10 flips of a fair coin. There are some errors.

Developing Criteria 2.4 (6%) points

Student incorrectly uses R to construct a histogram for the total number of heads in each of the 10,000 trials for 10 flips of a fair coin. There are many errors.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory assessment that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 7: Additional Histogram (1-7)–

Mastery Criteria 3.2 (8%) points

Student accurately uses R to construct a histogram for 10,000 trials for each of the following cases: 4 slips of a fair coin, 25 flips of a fair coin, and 100 flips of a fair coin. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student accurately uses R to construct a histogram for 10,000 trials for each of the following cases: 4 slips of a fair coin, 25 flips of a fair coin, and 100 flips of a fair coin. There are one or two minor errors.

Competent Criteria 2.72 (6.8%) points

Student uses R to construct a histogram for 10,000 trials for each of the following cases: 4 slips of a fair coin, 25 flips of a fair coin, and 100 flips of a fair coin. There are some errors.

Developing Criteria 2.4 (6%) points

Student incorrectly uses R to construct a histogram for 10,000 trials for each of the following cases: 4 slips of a fair coin, 25 flips of a fair coin, and 100 flips of a fair coin. There are many errors.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory assessment that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 8: Histograms Changes (1-8)–

Mastery Criteria 3.2 (8%) points

Student provides a thorough and detailed explanation describing how the distribution in the histogram changes for 4 flips to 10 flips to 25 flips to 100 flips and includes the Central Limit Theorem in his/her explanation for the changes.

Exceptional Criteria 2.98 (7.44%) points

Student provides a detailed explanation describing how the distribution in the histogram changes for 4 flips to 10 flips to 25 flips to 100 flips and includes the Central Limit Theorem in his/her explanation for the changes. There are one or two minor details missing.

Competent Criteria 2.72 (6.8%) points

Student provides an explanation describing how the distribution in the histogram changes for 4 flips to 10 flips to 25 flips to 100 flips and includes the Central Limit Theorem in his/her explanation for the changes. Some details are missing and/or lack clarity.

Developing Criteria 2.4 (6%) points

Student provides a cursory or incomplete explanation with vague or missing details describing how the distribution in the histogram changes for 4 flips to 10 flips to 25 flips to 100 flips and/or does not include the Central Limit Theorem in his/her explanation for the changes. Most details are missing.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 9: Histograms for Number of Coupons (1-9)–

Mastery Criteria 3.2 (8%) points

Student accurately creates histograms for the number of coupons used by 4 customers, 10 customers, 25 customers, and 100 customers; and compares these histograms including the Central Limit Theorem and compares his/her previous histograms where the probability was 50% including the central tendency. There are no errors/details missing.

Exceptional Criteria 2.98 (7.44%) points

Student accurately creates histograms for the number of coupons used by 4 customers, 10 customers, 25 customers, and 100 customers; and compares these histograms including the Central Limit Theorem and compares his/her previous histograms where the probability was 50% including the central tendency. There are one or two minor details missing.

Competent Criteria 2.72 (6.8%) points

Student creates histograms for the number of coupons used by 4 customers, 10 customers, 25 customers, and 100 customers; and compares with some details these histograms including the Central Limit Theorem and compares with some details his/her previous histograms where the probability was 50% including the central tendency. There are some errors/details missing and/or details lack clarity.

Developing Criteria 2.4 (6%) points

Student incorrectly creates histograms for the number of coupons used by 4 customers, 10 customers, 25 customers, and 100 customers; and/or vaguely compares these histograms including the Central Limit Theorem and/or vaguely compares his/her previous histograms where the probability was 50% including the central tendency. Most details are missing.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 10: Transform the Variable (2-1)–

Mastery Criteria 3.2 (8%) points

Student uses R code to accurately transform the variable Purchase into a new indicator for which the value is 1 if Citrus Hill is purchased and 0 if it is not. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student uses R code to accurately transform the variable Purchase into a new indicator for which the value is 1 if Citrus Hill is purchased and 0 if it is not. There are one or two minor errors.

Competent Criteria 2.72 (6.8%) points

Student uses R code to transform the variable Purchase into a new indicator for which the value is 1 if Citrus Hill is purchased and 0 if it is not. There are some errors.

Developing Criteria 2.4 (6%) points

Student uses R code to transform the variable Purchase into a new indicator for which the value is 1 if Citrus Hill is purchased and 0 if it is not. There are many errors.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 11: Characterize the Purchase Rate (2-2)–

Mastery Criteria 3.2 (8%) points

Student accurately calculates the purchase rate of Citrus Hill with a 95% confidence interval for the mean, odds, and logodds; and provides a thorough and detailed explanation of what the results tells him/her about Citrus Hill purchasing. There are no errors.

Exceptional Criteria 2.98 (7.44%) points

Student did not submit this element.Student accurately calculates the purchase rate of Citrus Hill with a 95% confidence interval for the mean, odds, and logodds; and provides a detailed explanation of what the results tells him/her about Citrus Hill purchasing. There are one or two minor errors.

Competent Criteria 2.72 (6.8%) points

Student calculates the purchase rate of Citrus Hill with a 95% confidence interval for the mean, odds, and logodds; and provides an explanation with some details of what the results tells him/her about Citrus Hill purchasing. There are some errors/details missing and/or details lack clarity.

Developing Criteria 2.4 (6%) points

Student inaccurately calculates the purchase rate of Citrus Hill with a 95% confidence interval for the mean, odds, and logodds; and/or provides a cursory or incomplete explanation with vague or missing details of what the results tells him/her about Citrus Hill purchasing. There are many errors.

Unacceptable Criteria 1.6 (4%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

Element 12: Statistical Technique Question (2-3)–

Mastery Criteria 4.8 (12%) points

Student provides a thorough and detailed explanation of one of the questions describing the statistical technique, explaining how it relates to the question including aligned hypotheses, and gives a statistically supported answer to the question. There are no errors/details missing.

Exceptional Criteria 4.46 (11.16%) points

Student provides a detailed explanation of one of the questions describing the statistical technique, explaining how it relates to the question including aligned hypotheses, and gives a statistically supported answer to the question. There are one or two minor errors/details missing.

Competent Criteria 4.08 (10.2%) points

Student provides an explanation of one of the questions describing the statistical technique, explaining how it relates to the question including aligned hypotheses, and gives a statistically supported answer to the question. There are some errors/details missing and/or details lack clarity.

Developing Criteria 3.6 (9%) points

Student provides a cursory or incomplete explanation of one of the question vaguely describing the statistical technique, explaining with few details how it relates to the question including aligned hypotheses, and gives a statistically supported answer to the question. There are many errors and/or details missing.

Unacceptable Criteria 2.4 (6%) points

Student provided an incomplete or cursory explanation that does not directly address this element and/or meet minimal requirements.

Not Submitted 0 (0%) points

Student did not submit this element.

 

Homework Writings Pro
Calculate your paper price
Pages (550 words)
Approximate price: -

Why should I choose Homework Writings Pro as my essay writing service?

We Follow Instructions and Give Quality Papers

We are strict in following paper instructions. You are welcome to provide directions to your writer, who will follow it as a law in customizing your paper. Quality is guaranteed! Every paper is carefully checked before delivery. Our writers are professionals and always deliver the highest quality work.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Reasonable Prices and Free Unlimited Revisions

Typical student budget? No problem. Affordable rates, generous discounts - the more you order, the more you save. We reward loyalty and welcome new customers. Furthermore, if you think we missed something, please send your order for a free review. You can do this yourself by logging into your personal account or by contacting our support..

Essay Delivered On Time and 100% Money-Back-Guarantee

Your essay will arrive on time, or even before your deadline – even if you request your paper within hours. You won’t be kept waiting, so relax and work on other tasks.We also guatantee a refund in case you decide to cancel your order.

100% Original Essay and Confidentiality

Anti-plagiarism policy. The authenticity of each essay is carefully checked, resulting in truly unique works. Our collaboration is a secret kept safe with us. We only need your email address to send you a unique username and password. We never share personal customer information.

24/7 Customer Support

We recognize that people around the world use our services in different time zones, so we have a support team that is happy to help you use our service. Our writing service has a 24/7 support policy. Contact us and discover all the details that may interest you!

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Our reputation for excellence in providing professional tailor-made essay writing services to students of different academic levels is the best proof of our reliability and quality of service we offer.

Essays

Essay Writing Service

When using our academic writing services, you can get help with different types of work including college essays, research articles, writing, essay writing, various academic reports, book reports and so on. Whatever your task, homeworkwritingspro.com has experienced specialists qualified enough to handle it professionally.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our professional editor will check your grammar to make sure it is free from errors. You can rest assured that we will do our best to provide you with a piece of dignified academic writing. Homeworkwritingpro experts can manage any assignment in any academic field.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.