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...