Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Python for Finance. - Second Edition

You're reading from  Mastering Python for Finance. - Second Edition

Product type Book
Published in Apr 2019
Publisher Packt
ISBN-13 9781789346466
Pages 426 pages
Edition 2nd Edition
Languages
Author (1):
James Ma Weiming James Ma Weiming
Profile icon James Ma Weiming

Table of Contents (16) Chapters

Preface 1. Section 1: Getting Started with Python
2. Overview of Financial Analysis with Python 3. Section 2: Financial Concepts
4. The Importance of Linearity in Finance 5. Nonlinearity in Finance 6. Numerical Methods for Pricing Options 7. Modeling Interest Rates and Derivatives 8. Statistical Analysis of Time Series Data 9. Section 3: A Hands-On Approach
10. Interactive Financial Analytics with the VIX 11. Building an Algorithmic Trading Platform 12. Implementing a Backtesting System 13. Machine Learning for Finance 14. Deep Learning for Finance 15. Other Books You May Enjoy

Multivariate linear regression of factor models

Many Python packages, such as SciPy, come with several variants of regression functions. In particular, the statsmodels package is a complement to SciPy with descriptive statistics and the estimation of statistical models. The official page for Statsmodels is https://www.statsmodels.org.

If Statsmodels is not yet installed in your Python environment, run the following command to do so:

$ pip install -U statsmodels
If you have an existing package installed, the -U switch tells pip to upgrade the selected package to the newest available version.

In this example, we will use the ols function of the statsmodels module to perform an ordinary least-squares regression and view its summary.

Let's assume that you have implemented an APT model with seven factors that return the values of Y. Consider the following set of data...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}