Compute the strike rate using the data frame

Assignment Help Advanced Statistics
Reference no: EM132222239

Project Description

In this assignment there are 4 parts. For each part you should:
• Write the appropriate code.
• Include comments within the code to explain what the code does.
• Test the code to ensure its correctness.
• Format and structure the code to maximise its readability.

Project Questions

The scorecard in Table 2 is from the first innings of the first cricket test in the Australia vs India 2018 series.

The columns show:

• Batsman: The name of the batsman.
• How Out: How the batsman was given out.
• Runs: The number of runs made by the batsman.
• Balls: The number of balls faced by the batsman.
• 4s: The number of 4s hit by the batsman.
• 6s: The number of 6s hit by the batsman.
• SR: The batsman's strike rate (100*Runs/Balls).

Validating the Strike Rate

Cricinfo believe that there is a bug in their code that computes the batsman's strike rate (SR), and so they want you to verify the numbers.

Write the code to:
1. Create a data frame in R containing the data from Table 2.
2. Compute the strike rate using the data frame from the Runs and Balls.
3. Subtract your computed strike rate from the data frame column SR. Finally, state if your output shows errors in the data, and where the errors occur.

Ball Outcome

Cricinfo want to create a simple cricket simulator to test their scorecard and so have come to you for help.
After a ball is bowled, there are eight possible outcomes. Below we list the eight outcomes and each outcome's eect on the score:
• 0 runs: add 1 to the ball count
• 1 run: add 1 to the ball count, add 1 to the run count
• 2 runs: add 1 to the ball count, add 2 to the run count
• 4 runs: add 1 to the ball count, add 4 to the run count, add 1 to the 4s count
• 6 runs: add 1 to the ball count, add 6 to the run count, add 1 to the 6s count
• Wide: add 1 to the extras count
• No ball: add 1 to the extras count
• Out: add 1 to the ball count, mark batsman as out
Cricinfo store a batsman's record using the variable:
state = list(balls = 0, runs = 0, fours = 0, sixes = 0, extras = 0, out = FALSE)

Write the function oneBall that takes the input state and one outcome and returns the updated state based on the eight outcomes above.

Batsman's score

A batsman keeps facing balls until the batsman is out. To simulate a single batsman, we need to:
1. Randomly sample one of the eight outcomes,
2. Update the score state,
3. Repeat until the outcome is Out.

Write the function oneBatsman that randomly samples one of the eight outcomes from above, updates the score using your function oneBall, then repeats until the outcome is Out. Note that we can randomly sample
an outcome using:
outcome = sample(c("0 runs", "1 runs", "2 runs", "4 runs", "6 runs", "Wide", "No Ball", "Out"), size = 1)

Team Score
The final piece of the simulation is to simulate the score for the whole team, and compute the team score. Write a function that contains the code to:
1. Simulate the scores for 10 batsmen (using the function oneBatsman).
2. Add the runs and extras from each batsman to obtain the team score.

Attachment:- Assignment.rar

Reference no: EM132222239

Questions Cloud

Discuss the process of capital investment : Capital Investment Analysis - Discuss the process of capital investment and the importance of capital investment decisions for health care managers today
Discuss the role of stakeholders in quality : Question - Discuss the role of stakeholders in quality and risk management including the relationships between employers and third party payers
Identify two different stock exchanges in the united states : Identify two different stock exchanges in the United States. Describe the similarities and differences between the two stock exchanges
Identify the research design you intend to use to answer : Quantitative Research Report Assignment Tasks - Identify the research design you intend to use to answer the problem/opportunity
Compute the strike rate using the data frame : 301113 - Programming for Data Science - Western sydney university - Create a data frame in R containing the data Table - Compute the strike rate using the data
Time-series extrapolation to forecast retail sales : Management of Davis’ Department Store has used time-series extrapolation to forecast retail sales for the next four quarters.
Which apply to traditional written contracts : J Frieden alluded that the enforceability of internet contracts are governed by well- established legal principles, which apply to traditional written contracts
Driver to return the horse to strauss : West purchased a horse from Strauss. When West discovered that the horse had a leg injury, he got a driver to return the horse to Strauss,
Prepare report on best practices in managing attendance : How to implement and monitoring issues Prepare a report on best practices in managing attendance.

Reviews

Write a Review

Advanced Statistics Questions & Answers

  Relationship between speed, flow and geometry

Write a project proposal on relationship between speed, flow and geometry on single carriageway roads.

  Logistic regression model

Compute the log-odds ratio for each group in Logistic regression model.

  Logistic regression

Foundations of Logistic Regression

  Probability and statistics

The tubes produced by a machine are defective. If six tubes are inspected at random , determine the probability that.

  Solve the linear model

o This is a linear model. If your model needs a different engine, then you need to rethink your approach to the model. Remember, there are no IF, Max, or MIN statements in linear models.

  Plan the analysis

Plan the analysis

  Quantitative analysis

State the hypotheses that you are going to test.

  Modelise as a markov chain

modelise as a markov chain

  Correlation and regression

What are the degrees of freedom for regression

  Construct a frequency distribution for payment method

Construct a frequency distribution for Payment method

  Perform simple linear regression

Perform simple linear regression

  Quality control analysis

Determining the root causes

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd