Multi factor model

The multi factor model can be used to decompose returns and calculate risk. The factors are constructed using pricing, fundamental, and analyst estimates data. I will use Systematic Investor Toolbox for this section.

The gzcon() function creates a connection and reads data in compressed format. Once we create a connection, we also have to close the connection.

The following commands explain this:

> con = gzcon(url('http://www.systematicportfolio.com/sit.gz', 'rb'))
>  source(con)
> close(con)

The following function is used to fetch Dow Jones components data from http://money.cnn.com and join() is taken from Systematic Investor Toolbox:

>dow.jones.components<- function(){
url = 'http://money.cnn.com/data/dow30/'
 txt = join(readLines(url)) ...

Get Learning Quantitative Finance with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.