I keep getting error working on my project 2 MAT 243. What am I doing wrong?
Step 3: Hypothesis Test for the Population Mean (I)
A relative skill level of 1420 represents a critically low skill level in the league. The management of your team has hypothesized that the average relative skill level of your team in the years 2013-2015 is greater than 1420. Test this claim using a 5% level of significance. For this test, assume that the population standard deviation for relative skill level is unknown. Make the following edits to the code block below:
After you are done with your edits, click the block of code below and hit the Run button above.
In [3]:
import scipy.stats as st
# Mean relative skill level of your team
mean_elo_your_team = your_team_df['elo_n'].mean()
print("Mean Relative Skill of your team in the years 2013 to 2015 =", round(mean_elo_your_team,2))
# Hypothesis Test
# ---- TODO: make your edits here ----
test_statistic, p_value = st.ttest_1samp('your_team_df'['1420'],'92' )
print("Hypothesis Test for the Population Mean")
print("Test Statistic =", round(test_statistic,2))
print("P-value =", round(p_value,4))
Mean Relative Skill of your team in the years 2013 to 2015 = 1419.43
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-3-1e18b44da253> in <module> 8 # Hypothesis Test 9 # ---- TODO: make your edits here ---- ---> 10 test_statistic, p_value = st.ttest_1samp('your_team_df'['1420'],'92' ) 11 12 print("Hypothesis Test for the Population Mean") TypeError: string indices must be integers
From your solution, it looks like your dataframe is your_team_df
So, you have replaced ??DATAFRAME_YOUR_TEAM?? with your_team_df
The name of the variable is elo_n
So, you have replaced ??RELATIVE_SKILL?? with 'elo_n'
The hypothesized mean is 1420. So, the syntax of st.ttest_1samp is,
test_statistic, p_value = st.ttest_1samp(your_team_df['elo_n'],1420)
You are getting type error as you are passing string value '92' where a numerical value is expected.
Get Answers For Free
Most questions answered within 1 hours.