Regression (heteroskedastic test) and PCA.
1) Explanation of important variables in the python code (with comment out function). 2) Use Jupiter notebook of python 3) Please clearly mention questions (a) or (b) or (1) or (2) in python code not to be confused. Guidance) Performance analysis of hedge fund returns using linear regression. Download and import the following data into your Jypyter notebook: /////// sample coding for your reference in case that you are not familiar with the dataset. /// import pandas_datareader.data as reader import pandas as pd import datetime as dt import statsmodels.api as sm import os import numpy as np import yfinance as yf from datetime import datetime #Load Stock price df = yf.download("QMNIX", start= datetime(2015,1,1), end = datetime(2021,9,1),interval='1mo') df end = dt.datetime(2021, 9,1 ) start = dt.datetime(2015, 1,1 ) funds= ['QMNIX'] fundsret = reader.get_data_yahoo(funds,start,end,interval='m')['Adj Close'].pct_change() fundsret.shape factors = reader.DataReader('F-F_Research_Data_5_Factors_2x3','famafrench',start,end)[0] factors.shape factors = factors[1:] factors.head() factors.shape fundsret = fundsret[2:] fundsret.head() fundsret.shape fundsret.index=factors.index fundsret merge = pd.merge(fundsret,factors,on='Date',how='left') merge.head() merge[['Mkt-RF','SMB','HML','RMW','CMA']]=merge[['Mkt-RF','SMB','HML','RMW','CMA']]/100 merge //////////////// • Monthly data of the Fama-French 5 Factor model from Ken French’s data library. (In the sample code above, it is already done. Please use it. ) • Monthly returns from Yahoo Finance for the AQR Equity Market Neutral Fund Class I (Ticker: QMNIX). Make sure you get the series that is adjusted for both dividends and splits (i.e. the series marked “Adj Close**” on Yahoo Finance). Note that Yahoo Finance will provide you with prices. Hence you will have to compute returns yourself. Question 1) Using the LinRegStatsmodels() Predictor Class, implement the performance analysis of the AQR hedge fund based on the Fama-French 5 Factor model by using heteroskedastic standard errors for all your statistics (heteroskedastic test). Question 2) PCA of Constant Maturity Treasury Rates