<jupyter_start><jupyter_text>1. Hypothesis Testing:  1. Closely related to Confidence Interval2. Starts with a null hypothesis and an alternative hypothesis3. Cheeck whether the data supports rejecting the null hypothesis pr fails to reject it<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline 
#Allows the plots to appear directly in this notebook

url = "http://faculty.marshall.usc.edu/gareth-james/ISL/Advertising.csv"
df = pd.read_csv(url,index_col = 0)
df.head()
import statsmodels.formula.api as smf
lm = smf.ols(formula = "sales~TV",data = df).fit()<jupyter_output><empty_output><jupyter_text>Null Hyp: There is no relationship between TV ads and Sales ( b1 = 0 ) Alternative Hyp: There is a relationship between TV ads and Sales ( b1 ! = 0 ) To test this hypothesis, intuitively we reject the null and accept the alternative, if the CI 95% doesnt include zero.Conversely, the p-value represents the probability that the coefficient is actually zero.  2. P-value<jupyter_code>lm.pvalues<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07844990548204159, 'fraction_numerical': 0.011342155009451797, 'mean_word_length': 5.379518072289157, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '257746', 'license': 'MIT', 'n_tokens_mistral': 341, 'n_tokens_neox': 319, 'n_words': 122, 'path': 'Data-Science-HYD-2k19/Topic-Wise/MACHINE LEARNING/2. Linear Regression/2d. Hypothesis testing and P-Values.ipynb', 'repo_name': 'Sanjay9921/Python', 'size': '1058'}