# Calculating the t statistic

I recently came across a blog post (https://cssanalytics.wordpress.com/2014/02/12/probabilistic-momentum-spreadsheet/) that discusses calculating a t-stat as part of their model. However, the formula they use I can't seem to reconcile with the way I think a two sample t-test is calculated. Since I'm not not sure how to do the formatting for math symbols I'll type it in as the authors of the blog post have it in their excel sheet. (the link to the excel sheet is found in the post linked above)

AVERAGE(C2:C61)/STDEV(C2:C61)*SQRT(COUNT(C2:C61))


I wouldn't expect the author to be wrong. How does this work as a t-stat?

• No, the way the authors have it is the way I posted it. Jun 3 '16 at 2:42
• sorry, I had a total bonehead moment! That's correct. But what are you expecting? Jun 3 '16 at 2:43
• You can't reconcile it with a two sample t-statistic because it's a one-sample t-statistic. Jun 3 '16 at 3:57

Sample mean: $$\mu = \frac{1}{n} \sum_i x_i$$ Sample variance: $$\sigma^2 = \frac{1}{n-1} \sum_i (x_i - \mu)^2$$ Sample standard deviation: $$\sigma = \sqrt{\frac{1}{n-1} \sum_i (x_i - \mu)^2}$$ Estimated variance of the sample mean: $$v = \frac{\sigma^2}{n}$$ Standard error (i.e. estimated standard deviation of the sample mean) $$se = \sqrt{v}$$ t stat: \begin{align*} t &= \frac{\mu}{se} \\ & = \frac{\mu}{\sqrt{\sigma^2/ n}} \\ & = \frac{\mu}{\sigma / \sqrt{n}} \\ & = \frac{\mu}{\sigma} \sqrt{n} \end{align*} Which is what they have: (AVERAGE / STDEV) * SQRT(COUNT)

• Thanks Matt! But one question. It's my understanding the authors are using two different samples, the returns from asset A and the returns from asset B. Shouldn't they have used a two sample test? Or is it because in the numerator they are averaging one value, the average of the difference between Asset A and Asset B? Jun 3 '16 at 4:03

They are doing a paired sample t test.

If you collect your data in pairs $(X_1,Y_1),(X_2,Y_2),\dots,(X_n,Y_n)$ and then you can consider the RVs $d_i=X_i-Y_i,$ $i=1,\dots,n$ .

Then, $d_i\sim N(\mu_d=\mu_X-\mu_Y, \sigma^2_d)$, then you have the test stat

$$t=\frac{\bar{d}-\mu_0}{s_d/\sqrt{n}}$$

A reference can be found here

There is something that is bugging me. Are these data collected over time? If so, this method is completely inappropriate.

• Wouldn't the data in the paired t-test have to come from the same group? In this example the data comes from two different assets. Thanks for the link. I'll review. Jun 3 '16 at 3:14
• @Josh If those are asset returns for different time periods, it's perfectly ok. Asset returns have huge cross-sectional correlation but tend to exhibit little autocorrelation. Returns are generally treated as independent across time. Jun 3 '16 at 4:19
• @huesecon I assumed they took those assets measurement in pairs somehow. If they did not, then the procedure is inappropriate.
– Josh
Jun 3 '16 at 4:39
• @MatthewGunn I never knew that, I would have assumed there would be a high autocorrelation. The more you learn.
– Josh
Jun 3 '16 at 4:39