Answer:
Explanation:
print("Confidence Interval for Average Relative Skill in the years 2013 to 2015")
print("------------------------------------------------------------------------------------------------------------")
# Mean relative skill of all teams from the years 2013-2015
mean = your_years_leagues_df['elo_n'].mean()
# Standard deviation of the relative skill of all teams from the years 2013-2015
stdev = your_years_leagues_df['elo_n'].std()
n = len(your_years_leagues_df)
#Confidence interval
stderr = stdev/(n ** 0.5) # variable stdev is the calculated the standard deviation of the relative skill of all teams from the years 2013-2015
# Calculate the confidence interval
# Confidence level is 95% => 0.95
# variable mean is the calculated the mean relative skill of all teams from the years 2013-20154
# variable stderr is the calculated the standard error
conf_int_95 = st.norm.interval(0.95, mean, stderr)
print("95% confidence interval (unrounded) for Average Relative Skill (ELO) in the years 2013 to 2015 =", conf_int_95)
print("95% confidence interval (rounded) for Average Relative Skill (ELO) in the years 2013 to 2015 = (", round(conf_int_95[0], 2),",", round(conf_int_95[1], 2),")")
print("\n")
print("Probability a team has Average Relative Skill LESS than the Average Relative Skill (ELO) of your team in the years 2013 to 2015")
print("----------------------------------------------------------------------------------------------------------------------------------------------------------")
mean_elo_your_team = your_team_df['elo_n'].mean()
# Calculates the probability a Team has Average Relative Skill GREATER than or equal to the Average Relative Skill (ELO) of your team in the years 2013 to 2015
choice1 = st.norm.sf(mean_elo_your_team, mean, stdev)
# Calculates the probability a Team has Average Relative Skill LESS than or equal to the Average Relative Skill (ELO) of your team in the years 2013 to 2015
choice2 = st.norm.cdf(mean_elo_your_team, mean, stdev)
# Pick the correct answer.
print("Which of the two choices is correct?")
print("Choice 1 =", round(choice1,4))
print("Choice 2 =", round(choice2,4)) # This is correct