Statistics courses

If you need to learn more about statistics, or brush up on some existing knowledge, check out Udacity's courses on Descriptive Statistics-描述统计学and Inferential Statistics-推论统计学.

The Many Meanings of "Alpha"

Disambiguation of the term “Alpha”

You will hear the term “alpha” throughout this program, so we want to let you know early on that the term “alpha” is used to mean multiple things in the investment industry.

In mathematics, you’ll see alpha refer to the significance level of a hypothesis test. In regression, you’ll see alpha refer to the y-intercept of a straight line.

In finance, alpha refers to multiple distinct but somewhat related ideas. The common thread among these definitions is that alpha is the extra value that an investment professional can add to the performance of an investment.

One specific definition of alpha is the extra return that an actively managed fund can deliver, that exceeds the performance of passively investing (buy and hold) in a portfolio of stocks. Another specific definition of alpha, which we’ll primarily focus on in this course, is that of an alpha vector.
α的一个具体定义是主动管理基金可以提供的额外回报，超过了股票投资组合中被动投资（买入和持有）的表现。我们将主要关注的另一个特定的alpha定义是alpha矢量。

An alpha vector is a list of numbers, one for each stock in a portfolio, that gives us a signal as to the relative future performance of these stocks. You’ll learn more about alpha vectors throughout term 1.
α矢量是一个数字列表，一个是投资组合中每个股票的一个，它给我们一个关于这些股票相对未来表现的信号。您将在第1学期了解有关alpha矢量的更多信息。

Just to be clear, the finance community, both in academia and industry, use alpha to denote multiple ideas.

In this lesson, you may have noticed that we use “alpha” in the statistical sense when we talked about hypothesis testing. We also used when saying that we may “find alpha” in a strategy. This second usage refers to outsized performance, or better-than-passive performance that a finance professional can add to an investment. Later on, we will use it in the sense of an alpha vector, which is a list of numbers that give us a signal about the relative performance of each stock.

Test Returns for Statistical Significance

Complete the function analyze_returns below.

This linkprovides a useful reference on the scipy.stats package. This part is about the t-test.

statistical_test.py

import pandas as pd
import numpy as np
import scipy.stats as stats

def analyze_returns(net_returns):
"""
Perform a t-test, with the null hypothesis being that the mean return is zero.

Parameters
----------
net_returns : Pandas Series
A Pandas Series for each date

Returns
-------
t_value
t-statistic from t-test
p_value
Corresponding p-value
"""
# TODO: Perform one-tailed t-test on net_returns
# Hint: You can use stats.ttest_1samp() to perform the test.
#       However, this performs a two-tailed t-test.
#       You'll need to divde the p-value by 2 to get the results of a one-tailed p-value.
null_hypothesis = 0.0

return None

def test_run(filename='net_returns.csv'):
"""Test run analyze_returns() with net strategy returns from a file."""
t, p = analyze_returns(net_returns)
print("t-statistic: {:.3f}\np-value: {:.6f}".format(t, p))

if __name__ == '__main__':
test_run()

net_returns.csv

date,return
2014-11-30,0.011635519414351009
2014-12-31,0.021954092308170955
2015-01-31,0.04088726605224263
2015-02-28,-0.0025112428290965105
2015-03-31,0.01725861669076579
2015-04-30,0.04169672034614155
2015-05-31,0.033973104078552634
2015-06-30,0.011808567427224085
2015-07-31,-0.034296712711723694
2015-08-31,-0.018000336527001545
2015-09-30,0.04244859300243494
2015-10-31,0.06048679384582347
2015-11-30,0.004425442647837301
2015-12-31,-0.011128068116992282
2016-01-31,0.03904059055851628
2016-02-29,-0.018534757459136356
2016-03-31,0.051492028368816355
2016-04-30,0.008987284920489497
2016-05-31,0.04030096220308846
2016-06-30,-0.07014813509500822
2016-07-31,-0.03744600404974712
2016-08-31,-0.05765103830475751
2016-09-30,0.05280791013124859
2016-10-31,0.04813615235947365
2016-11-30,0.019069757993200993
2016-12-31,0.02369364599868217
2017-01-31,-0.022749483402672258
2017-02-28,-0.07743936042570741
2017-03-31,0.03324798542019691
2017-04-30,-0.02091584879987623
2017-05-31,-0.06955420357572517
2017-06-30,0.003758874907665249

Quize:Statistical Analysis

The t-Test

Let's say we've calculated a set of monthly returns, and we've calculated their mean. Now, we'll perform a t-test to see if we can infer from our limited data set that our trading strategy is likely to yield positive returns. We'll perform a one-tailed t-test with the null hypothesis that \muμ, the true mean return from our trading strategy, equals 0

In which situation might we conclude that our trading strategy is likely to yield positive returns (check all that apply)?

Correct! Low p-values tell us that if the true mean is 0, we would be unlikely to observe a mean as or more "extreme" than the mean we observed.