# Hypothesis Testing: how to determine significance ????

The main question we are interested in answering is:Does discount amount have a statistically significant effect on the amount of product ordered?.The data tables contained in the database are mapped out in the Entity Relationship Diagram (ERD) below, which show how the various tables are interrelated.The data required to answer the research question, quantity of product ordered and discount amount, is located in the OrderDetail table..The research question is whether discount amount has a statistically significant effect on the quantity of product ordered..The null hypothesis (which we’ll explain in more detail later on) is that a sample comes from a normal distribution..The specific type of test we are performing is referred to as a right-tailed test because we are claiming the parameter to be greater than a certain value.HypothesesHₒ: There is no difference in the mean quantity of product ordered when comparing customers who did not receive a discount with customers who received a discountHₐ: The mean quantity of product ordered by customers who received a discount should be greater than 21.7, the mean quantity of product ordered by customers without a discountSignificance level and powerNext, set a level of significance called alpha (α) to make a statistical decision about the null hypothesis..The reason why is because we want to present evidence against the null hypothesis, so we want to minimize α.Type I error: accept ‘discount amount has an effect’ when it does not (i.e. keep offering discounts when it has no effect, resulting in lower revenue)Type II error: reject ‘discount amount has an effect’ when it does have an effect (i.e. offer no discounts when it actually has an effect on the quantity of product ordered, resulting in failure to capture potential additional revenue)Notice how the Type I error is considered to be the more egregious offense because the company is losing money by doing something that has no value.All of this is directly tied to the concept of statistical power..There is statistical evidence at the 5% level of significance to conclude that the mean quantity of product ordered by customers who received a discount is greater than 21.7, the mean quantity of product ordered by customers in the control group.Effect sizeWhile we may claim a statistical difference exists, we also need to measure the magnitude of the difference..This is known as the effect size which is immune to sample size, unlike the p-value..Thus it is important to calculate effect size because if the sample size is very large we may obtain significant results where there really should not be one..Effect size is commonly measured using Cohen’s d, where values of 0 – 0.2 have little or no effect and values > 0.8 have a large effect size.Now we can claim that discount amount has a large statistically significant effect on quantity of product ordered.One-way ANOVAWe know discount amount has an effect, but at what levels of discount amount do we observe a statistically significant effect?.To determine which level, we perform a multiple comparisons analysis to compare all possible pairwise means.To definitively answer the original research question:Discount amounts of 5, 15, 20 and 25% produce a large and statistically significant effect on the mean quantity of product ordered.More practiceLet’s explore a few more research questions that may provide valuable information to the company.1..Does supply region have a statistically significant effect on unit price?Hₒ: There is no difference in mean unit price among supplier regionsHₐ: There is at least one supplier region with a different mean unit priceThe overall model is not significant since p (1.0) > α..Is the mean freight price significantly different between Federal Shipping and Speedy Express?Hₒ: There is no difference in the mean freight price between Federal Shipping and Speedy ExpressHₐ: There is a difference in the mean freight price between Federal Shipping and Speedy Expressp (1.6e-22) < α, so we reject the null hypothesis and find strong evidence for a significant difference in the mean freight price between Federal Shipping and Speedy Express.. More details