Back to Community
Quantopian Lecture Series: Confidence Intervals (Professor Collaboration)

In statistics, confidence intervals are used to represent a range in which a right answer is likely to exist. The are an elegant way of quantifying uncertainty, and ubiquitous in many parts of statistical testing. This notebook comes out of a collaboration with Professor Jeremiah Johnson at the University of New Hampshire. He coordinates their new data science curriculum, and uses Quantopian as a teaching tool.

Find all of our lectures at

Loading notebook preview...
Notebook previews are currently unavailable.

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

4 responses

hey(: i am new to quantopian and currently following the lecture series. i was just browsing through the notebook for this new tutorial and stumbled across something. shouldnt this line "Where σ is the sample mean and n is the number of samples" read "Where σ is the sample standard deviation and n is the number of samples"? because the standard error is calculated using the standard deviation not the mean. or am i missing something here?

Hi Luis,

That is indeed a very confusing typo. I apologize and will work to get it fixed ASAP. Your interpretation is correct.


okay, thanks for the quick reply. and thanks for the lecture series btw - it is a great resource!

"Assuming our data are normally distributed, we can use the standard error to compute our confidence interval. (...) When the samples are large enough (generally > 30 is taken as a threshold) the Central Limit Theorem applies and normality can be safely assumed; if sample sizes are smaller, a safer approach is to use a t -distribution with appropriately specified degrees of freedom."

The CLT does not require the distribution being sampled from to be normal. The less normal and more skewed the distribution, the higher n required for CLT to hold. But on the other hand, if the CLT does hold, and the mean of the samples is normally distributed, that does not mean the underlying distribution is normal. (It could be Poisson, or a t with fatter tails, for example).