Project5

docx

School

Northeastern University *

*We aren’t endorsed by this school

Course

6000

Subject

Computer Science

Date

Jun 10, 2024

Type

docx

Pages

9

Uploaded by CoachElementEmu28

Report
ALY 6000: Introduction To Analytics Module 5 Project Report: Probability and Counting with R INTRODUCTION Module 5 of ALY 6000 gives us an insight into probability and counting. We learn about probability, and counting and how to calculate both using R. In this module we learn what’s a sample space, events and outcomes and how to calculate them. We also learn the different functions the R has to calculate probability of events.
1. Download the data set ball-dataset.csv and read it into your script. Each ball in the dataset is represented by a color (red, blue, green, or yellow) and a label (A, B, C, D, or E). OUTPUT: 2. Create a frequency table as a data.frame or tibble that contains counts for each color of ball (freq_color). OUTPUT: 3. Create a frequency table as a data.frame or tibble that contains counts for each label of ball (freq_label). OUTPUT: 4. Create a bar chart of the ball data set representing the counts of the different colors. OUTPUT:
5. Create a bar chart of the ball data set representing the counts of the different labels. OUTPUT: 6. What is the probability of drawing a green ball (prob6_result)? OUTPUT:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
7. What is the probability of drawing a blue or a red ball (prob7_result)? OUTPUT: 8. What is the probability of drawing a ball with a label of A or C (prob8_result)? OUTPUT: 9. What is the probability of drawing a yellow ball with a D (prob9_result)? OUTPUT: 10. What is the probability of drawing a yellow ball or a ball with a D (prob10_result)? OUTPUT: 11. What is the probability of drawing a blue ball followed by a red ball without replacement (prob11_result)? OUTPUT:
12. What is the probability of drawing four green balls in a row without replacement (prob12_result)? OUTPUT: 13. What is the probability of drawing a red ball followed by a ball with a B without replacement (prob13_result)? OUTPUT: 14. [Challenge] Write a function called my_factorial that computes the factorial of a given number. – my_factorial (0) = 0 – my_factorial(3) = 6 – my_factorial(5) = 120 OUTPUT : 15. Manually create a data.frame or tibble that contains all possible outcomes of flipping the coin four times (coin_outcomes). OUTPUT:
16. Compute the probability of each row outcome and store it as a column in the data.frame or tibble. You can do this manually or programmatically (coin_outcomes). OUTPUT: 17. There are 5 possible outcomes in our coin dataset if we count the number of heads in each row. For example, the row “H H H H” has 4 heads and the row “H T H T” has 2 heads. Compute the probability of each of the 5 possible outcomes (num_heads_prob). OUTPUT:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
18. What is the probability of an outcome of three heads (prob18_result)? OUTPUT: 19. What is the probability of an outcome of two heads or four heads (prob19_result)? OUTPUT: 20. What is the probability of an outcome of less than or equal to three heads (prob20_result)? OUTPUT: 21. Create a bar chart where the x-axis is the outcome, and the y-axis is the probability. OUTPUT:
SOCCER GAMES The following problems consider a soccer team with a 75% chance of winning a game at home and a 50% chance of winning away games. Consider that the team is about to play 10 games: five at home and five away. 22. What is the probability that they will win exactly 10 games (prob22_result)? OUTPUT: 23. What is the probability that they will win more than one game (prob23_result)? OUTPUT: 24. How many different ways could you pick five games at random and have three home games and two away games (prob24_result)?
OUTPUT: CONCLUSION This module has taught me on how to calculate probability in R. I also learnt concepts on counting, permutations and combinations and discrete continuous probability. The challenge problems were a little difficult in the beginning but as I went through the Allan Bluman Text Book and other resources on the internet, I understood the concept and solved it in the end. CITATIONS 1. R in Action, Third Edition by Robert I. Kabacoff 2. Tenth Edition Bluman Elementary Statistics-A Step by Step Approach, McGraw- Hill Education by Allan G.Bluman
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help