Question: Let's hypothesize that the mean tip percentage in the population is 1 7 % . Use sample _ mean, standard _ error, and the hypothesized
Let's hypothesize that the mean tip percentage in the population is Use samplemean, standarderror, and the hypothesized value to calculate the tstatistic. Then use scipy.stats's norm.cdf function to calculate the pvalue. Finally, decide whether you reject or fail to reject the hypothesis. Store your answers in the variables tstat, pval, and rejectornot. The variable rejectornot should either be the string 'reject' or the string 'fail to reject'. Remember to look at the units of the variable tippercentage in the output of taxi.head above in order to set the hypothesized value correctly. my code is wrong: import numpy as np
import pandas as pd
from scipy.stats import norm
taxi pdreadcsvassetstaxicsv
tippercentages taxitippercentage'
hypothesizedmean
samplemean npmeantippercentages
samplesize lentippercentages
samplevar npvartippercentages, ddof
standarderror npsqrtsamplevar samplesize
tstat samplemean hypothesizedmean standarderror
pval norm.cdfnpabststat
alpha # Significance level
rejectornot 'reject' if pval alpha else 'fail to reject'
printftstatistic: tstat
printfpvalue: pval
printfDecision: rejectornot error code: You have failed this test due to an error. The traceback has been removed because it may contain hidden tests. This is the exception that was thrown:
AssertionError: Problem :Your answer for tstat does not match the official answer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
