Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Test of heteroskedasticity, Breusch, and Pagan (1979)


Breusch and Pagan (1979) designed a test to confirm or reject the null assumption that the residuals from a regression is homogeneous, that is, with a constant volatility. The following formula represents their logic. First, we run a linear regression of y against x:

Here, y is the independent variable, x is the independent variable, α is the intercept, β is the coefficient and is an error term. After we get the error term (residual), we run the second regression:

Assume that the fitted values from running the previous regression is , then the Breusch-Pangan (1979) measure is given as follows, and it follows a χ2 distribution with a k degree of freedom:

The following example is borrowed from an R package called lm.test (test linear regression), and its authors are Hothorn et al. (2014). We generate a time series of x, y1 and y2. The independent variable is x, and the dependent variables are y1 and y2. By our design, y1 is homogeneous,...