Case Scenario 1

This is the fourth season of outfielder Luis Robert with the Chicago White Socks. If during the first three seasons he hit 11, 13, and 12 home runs, how many does he need on this season for his overall average to be at least 20?

Solution

Given that x1=11,x2=13,x3=12

we want to find x4 such that the mean (average) number of home-runs is x¯>=20

Notice that in this case n=4 .

According to the information above: 20×4=11+13+12+x4

so when x4=61 , the home-runs average will be 20.

# Home-runs so far
hr_before <- c(11,13,12)

# Average number of home-runs per season wanted
wanted_hr <- 20

n_seasons <- 4

# Needed home-runs on season 4
x_4 <- n_seasons * wanted_hr - sum (hr_before)

# Minimum number of home-runs needed by Robert
x_4
[1] 44

According to the calculations above, Robert must hit 44 home-runs or better on this season to get an average number of home-runs per season of at least 20.

We could confirm this, by using the function mean() in R.

# Robert's performance
robert_hrs <- c( 11, 13, 12, 44)

# Find mean
mean(robert_hrs)
[1] 20
# Find the standard deviation
sd (robert_hrs)
[1] 16.02082
# Find the maximum number of home-runs during the four seasons period
max (robert_hrs)
[1] 44
# Find the minimum number of home-runs during the four seasons period
min (robert_hrs)
[1] 11

The summary() function can be used to find basic statistics, including the median.

summary (robert_hrs)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  11.00   11.75   12.50   20.00   20.75   44.00 

Question 1 Now, you must complete the problem below which represents a similar case scenario. You may use the steps that we executed in Case-scenario 1 as a template for your solution.

This is the sixth season of outfielder Juan Soto in the majors. If during the first five seasons he received 79, 108,41,145, and 135 walks, how many does he need on this season for his overall number of walks per season to be at least 100?

# Walks so far
walks_before <- c( 79, 108, 41, 145, 135)

# Average overall number of walks needed (at least)
average_walks_wanted <- 100

# Number of seasons
seasons <- 6

# Needed walks on season 6
walks_season_six = ( seasons * average_walks_wanted ) - sum(walks_before)

# Print minimum walks needed on season 6
walks_season_six
[1] 92

Juan Soto needs at least 92 walks on season six to average an overall average of 100 across all six seasons

Case Scenario 2

The average salary of 10 baseball players is 72,000 dollars a week and the average salary of 4 soccer players is 84,000. Find the mean salary of all 14 professional players.

Solution

mean_weekly_salary_baseball <- 72000
mean_weekly_salary_soccer <- 84000

number_baseball_players <- 10
number_soccer_players <- 4

overall_mean_weekly_salary = ((number_baseball_players * mean_weekly_salary_baseball) + 
  (number_soccer_players * mean_weekly_salary_soccer) ) / (number_soccer_players + number_baseball_players)

overall_mean_weekly_salary
[1] 75428.57

Question 2 The average salary of 7 basketball players is 102,000 dollars a week and the average salary of 9 NFL players is 91,000. Find the mean salary of all 16 professional players.

mean_weekly_salary_basketball <- 102000
mean_weekly_salary_nfl <- 91000

number_basketball_players <- 7
number_nfl_players <- 9

overall_mean_weekly_salary = ((number_basketball_players * mean_weekly_salary_basketball) + (number_nfl_players * mean_weekly_salary_nfl) ) / (number_nfl_players +    number_basketball_players)

overall_mean_weekly_salary
[1] 95812.5

The mean salary of all 16 professional players is $95,812.50

Case Scenario 3

The frequency distribution below lists the number of active players in the Barclays Premier League and the time left in their contract.

  1. Find the mean,the median and the standard deviation.
contract_lenght <- read.csv('allcontracts.csv', header = TRUE, sep = ",")

contract_years <- contract_lenght$years
contracts_mean <- mean(contract_years)
contracts_mean 
[1] 3.46
# Median
contracts_median <- median (contract_years)
contracts_median 
[1] 3
# Find the number of observations
contracts_n <- length (contract_years)

# Find the standard deviation
contracts_sd <- sd(contract_years)
  1. What percentage of the data lies within one standard deviation of the mean?
contracts_within_1_sd <- sum (((contract_years - contracts_mean) / contracts_sd < 1) / contracts_n)

contracts_within_1_sd
[1] 0.842
# Difference from empirical
contracts_within_1_sd - 0.68
[1] 0.162

The percentage of contracts within 1 standard deviation of the mean is 0.84

  1. What percentage of the data lies within two standard deviations of the mean?
contracts_within_2_sd <- sum (((contract_years - contracts_mean) / contracts_sd < 2) / contracts_n)

contracts_within_2_sd
[1] 1
# Difference from empirical
contracts_within_2_sd - 0.95
[1] 0.05

The percentage of contracts within 2 standard deviation of the mean is 100%

  1. What percent of the data lies within three standard deviations of the mean?
contracts_within_3_sd <- sum (((contract_years - contracts_mean) / contracts_sd < 3) / contracts_n)

contracts_within_3_sd
[1] 1

The percentage of contracts within 3 standard deviation of the mean is 100%

# Difference from empirical
contracts_within_3_sd - 0.9973
[1] 0.0027
  1. Draw a histogram to illustrate the data.
hist (contract_years, xlab = "Years Left in Contract", col = "yellow", border = "red", xlim = c(0,8), ylim = c(0,225), breaks = 5)

boxplot(contract_years, main="Years Left in Contract", ylab= "Years", col="lightblue", border="blue3")

Question 3

Use the skills learned in case scenario number 3 on one the following data sets. You may choose only one dataset. They are both available in Canvas.

  1. Find the mean,the median and the standard deviation.
data <- read.csv("doubles_hit.csv", header = TRUE, sep = ",")

doubles_hit <- data$doubles_hit
doubles_mean <- mean(doubles_hit)

#print mean
doubles_mean
[1] 23.55
doubles_median <- median(doubles_hit)

#print media
doubles_median
[1] 23.5
doubles_sd <- sd(doubles_hit)

#print standard deviation
doubles_sd
[1] 13.37371
doubles_length <- length(doubles_hit)

#print length of colum
doubles_length
[1] 100
  1. What percentage of the data lies within one standard deviation of the mean?
doubles_within_one_sd <- sum (((doubles_hit - doubles_mean) / doubles_sd < 1) / doubles_length)

#print result
doubles_within_one_sd
[1] 0.79
# Difference from empirical
doubles_within_one_sd - 0.68
[1] 0.11

*The percentage of double hits within 1 standard deviation from the mean is 0.79.

  1. What percentage of the data lies within two standard deviations of the mean?
doubles_within_two_sd <- sum (((doubles_hit - doubles_mean) / doubles_sd < 2) / doubles_length)

#print result
doubles_within_two_sd
[1] 1
# Difference from empirical
doubles_within_two_sd - 0.95
[1] 0.05

The percentage of double hits within 2 standard deviations from the mean is 1.

  1. What percent of the data lies within three standard deviations of the mean?
doubles_within_three_sd <- sum (((doubles_hit - doubles_mean) / doubles_sd < 3) / doubles_length)

#print result
doubles_within_three_sd

The percentage of double hits within 3 standard deviations from the mean is 1.

# Difference from empirical
doubles_within_three_sd - 0.9973
[1] 0.0027
  1. Draw a histogram to illustrate the data.
hist (doubles_hit, xlab = "Number of Double Hits", col = "blue", border = "yellow", xlim = c(0,50), ylim = c(0,30), breaks = 10)

boxplot(doubles_hit, main="Boxplot of Doubles Hit by Player", ylab= "Doubles", col="blue", border="lightblue")

The boxplot provides several insights about the distribution of doubles hit by players:

Overall, this distribution appears relatively symmetrical, with no significant skewness or extreme variations. The data suggests a fairly consistent performance among the players in terms of hitting doubles.

LS0tCnRpdGxlOiAiR2V0dGluZyBTdGFydGVkIHdpdGggUjogQ29uY2VwdHMgaW4gU3BvcnRzIEFuYWx5dGljcyIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKIyMjIENhc2UgU2NlbmFyaW8gMQoKVGhpcyBpcyB0aGUgZm91cnRoIHNlYXNvbiBvZiBvdXRmaWVsZGVyIEx1aXMgUm9iZXJ0IHdpdGggdGhlIENoaWNhZ28gV2hpdGUgU29ja3MuIElmIGR1cmluZyB0aGUgZmlyc3QgdGhyZWUgc2Vhc29ucyBoZSBoaXQgMTEsIDEzLCBhbmQgMTIgaG9tZSBydW5zLCBob3cgbWFueSBkb2VzIGhlIG5lZWQgb24gdGhpcyBzZWFzb24gZm9yIGhpcyBvdmVyYWxsIGF2ZXJhZ2UgdG8gYmUgYXQgbGVhc3QgMjA/CgoqKlNvbHV0aW9uKioKCkdpdmVuIHRoYXQgeDE9MTEseDI9MTMseDM9MTIKCndlIHdhbnQgdG8gZmluZCB4NAogc3VjaCB0aGF0IHRoZSBtZWFuIChhdmVyYWdlKSBudW1iZXIgb2YgaG9tZS1ydW5zIGlzIHjCrz49MjAKCk5vdGljZSB0aGF0IGluIHRoaXMgY2FzZSBuPTQKLgoKQWNjb3JkaW5nIHRvIHRoZSBpbmZvcm1hdGlvbiBhYm92ZTogMjDDlzQ9MTErMTMrMTIreDQKCnNvIHdoZW4geDQ9NjEKLCB0aGUgaG9tZS1ydW5zIGF2ZXJhZ2Ugd2lsbCBiZSAyMC4KCmBgYHtyfQojIEhvbWUtcnVucyBzbyBmYXIKaHJfYmVmb3JlIDwtIGMoMTEsMTMsMTIpCgojIEF2ZXJhZ2UgbnVtYmVyIG9mIGhvbWUtcnVucyBwZXIgc2V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