#### Overview of this book

Python for Finance
Credits
Acknowledgments
www.PacktPub.com
Preface
Free Chapter
Introduction and Installation of Python
13 Lines of Python to Price a Call Option
Introduction to Modules
Statistical Analysis of Time Series
Index

## T-test and F-test

In finance, T-test could be viewed as one of the most used statistical hypothesis tests in which the test statistic follows a student's t distribution if the null hypothesis is supported. We know that the mean for a standard normal distribution is zero. In the following program, we generate 1,000 random numbers from a standard distribution. Then, we conduct two tests: test whether the mean is `0.5`, and test whether the mean is zero:

```>>>from scipy import stats
>>>np.random.seed(1235)
>>>x = stats.norm.rvs(size=10000)
>>>print("T-value   P-value (two-tail)")
>>>print(stats.ttest_1samp(x,5.0))
>>>print(stats.ttest_1samp(x,0))
T-value   P-value (two-tail)
(array(-495.266783341032), 0.0)
(array(-0.26310321925083124), 0.79247644375164772)
>>>
```

For the first test, in which we test whether the time series has a mean of `0.5`, we reject the null hypothesis since the T-value is `495.2` and the P-value is `0`. For the second...