# How is hypothesis testing work in population sampiling? [closed]

I am learning the basics of quant trading from quantconnect's tutorial Confidence Interval and Hypothesis Testing. I understood the first part of the article but I dont understand "Hypothesis Testing" section.

From the article

Now we can talk about hypothesis testing. Hypothesis test is essentially test your inference based on a sample. Let's use our dataset, the daily return of S&P 500 us our population. Assume that we don't know the mean of this population. I guess that the mean of this population is 0. Is my guess correct? I need to test this hypothesis with my sample. Let's start from observing our sample:

The null hypothesis(mean=0) and alternative hypothesis(mean not equal 0) are

H0:μ¯=0
H0:μ¯≠0


and confidence interval used are

90% confidence interval
the mean is between (-0.00039756352254768874, 0.00039756352254768874)

95% confidence interval
the mean is between (-0.00047513689280089639, 0.00047513689280089639)


They reject null hypothsesis for 90% confidence because real mean 0.000463 is outside the confidence mean range

Our mean of the sample is out of the 90% confidence interval. This means on a 90% confidence level, we can claim that the mean of our population is not 0.

Then in 95%, real mean is inside the confidence intervals range and so we accept the null hypothesis.

Shouldn't this the other way around because the real mean is inside the range of 95% confidence interval so mean of the population should be not zero ? What is the rationale behind it? Then they talk about z-score method which also I am not able to grasp? How do this applied to popultion sampiling? How is this idea applied in trading(any example)?

## 1 Answer

This is pretty standard fare for a Stats 101 course, so as to rationale, etc. you might benefit from picking up a textbook or otherwise do some reading on this.

In brief though, hypothesis testing allows us to assess the likelihood sample estimates are different than theorized values in the absence of actual population values.

In the cases above, with a null hypothesis of 0, sufficient sample size to assume a normal distribution, and sample standard error, you can assert you would only see a sample mean as extreme as +/-0.00039756352254768874 by chance 10% of the time. Hence, as your calculated sample mean is outside that range, you would reject the null that the population mean is equal to 0 and assert that your sample mean is staistically significant at the 10% level. However, you can't reject the null in the 95% case because your sample mean isn't extreme enough.