Here is a spreadsheet I created to test the effect of various stock prices and market caps on price and value weighted indices. You should create a similar spreadsheet (though formatted better -- the first sheet should be a summary with a description of what you are doing and the important results, i.e. the correlations). You can also add in interesting charts and possibly an equally-weighted index.
Note, by pressing 'F9' you'll recalculate the '=RAND()' functions, which will give you entirely new correlations. You could hit 'F9' many times, recording the resulting correlations, and get a Monte Carlo estimate of the correlation distributions. A macro may be effective in doing this.
I have posted a new working paper of mine to the 'Working Paper' section. The paper, Parameter Variation & the Components of Natural Gas Price Volatility, hypothesizes that parameters linking natural gas returns to fundamental variables will tend to change as market participants learn. I therefore estimate the parameters using the Kalman filter. I also decompose conditional natural gas volatility into portions attributable to each variable. The abstract is below.
Estimating a static coefficient for a deseasoned gas storage or
weather variable implicitly assumes that market participants react
identically throughout the year (and over each year) to that variable.
In this analysis we model natural gas returns as a linear function of
gas storage and weather variables, and we allow the coefficients of this
function to vary continuously over time. This formulation takes into
account that market participants continuously try to improve their
forecasts of market prices, and this likely means they continuously
change the scale of their reaction to changes in underlying variables.
We use this model to also calculate conditional natural gas volatility
and the proportion of volatility attributable to each factor. We find
that return volatility is higher in the winter, and this increase is at-
tributable to increases in the proportion of volatility due to weather
and natural gas storage. We provide time series estimates of the chang-
ing proportion of volatility attributable to each factor, which is useful
for hedging and derivatives trading in natural gas markets.
See the introduction, which includes a brief assignment, HERE.
Here is a brief intro to Synthetic CDOs and their Applications.
I have implemented the simple model from our text HERE.
The code to estimate the daily squared deviation for each day in the trading period, and for each pair, is here trading_period.
This code will test whether a stock has a significant alpha over the last 5040 calendar days. It will then calculate alpha and beta over each 30 day subinterval and test whether alpha in one period can be used to predict alpha in the next period. The time series of alphas and betas are also plotted. The code is here: time_series_alpha.
I have totally rewritten the pairs trade estimation period code. It will create a csv file in your working directory which has the average squared deviation, and the standard deviation of the squared deviations, for all pairs. The csv is sorted from lowest (best pair) to highest (worst pair) average squared deviation. The code is here estim_period.
See the R markdown page here: alpha_across_firms.