Hi,

This is probably trivial to most people out there, but I'm struggling with this.

I have a data set which contains the closing prices (properly adjusted for dividends and splits) for several hundred securities and the closing prices for a general stock market index (S&P 500).  I have no problem getting it into R with RODBC and manipulating it.  There are no missing values.  I can easily turn the closing price series into a daily return series.

I'm trying to determine for each of the securities it's correlation to the index both in terms of an overall "beta" and the variance associated with the name.  For example a security might happen to average out to looking like it tracks the index, but the variance may be so high that it is not reliable.  I need to figure out how to score these names against the index.

I've looked at the cor() and cov() functions, but I couldn't figure out exactly how to use them to get this information.

I can put this data into excel and cover up with the mean of daily return for each name divided by the index return.  I can also come up with the variance of this, which is a good start.  I'd much rather do this in R, and I'm sure it's much more suited for this.  Also, there may be a better approach to this and I would be interested in any suggestions.

To give you a practical example, at the end of the day I may have long and short positions in twenty names in a trading account.   If there is a net exposure to the index then I can hedge it with index futures.  But, if there's low correlation, then I can't.  

Thanks,

Josh Kalish



==============================================================================
Please access the attached hyperlink for an important electr...{{dropped}}

