Asset Pricing [10a : Comparing Models]

In my attempt to replicate some of the methodologies of the Kritzman paper, I stumbled across an article by Hardy (2001) which I thought I might try to tinker with as well. To summarise :  the paper itself is concerned with the following issues [1] A comparison of the fit of Regime Switching Log Normal (RSLN) model with other conventional models in common use for the SP500 / TSE 300 indices ; [2] Derivation of the distribution function for the RSLN model ; [3] Derivation of the European option price using the RSLN model ; [4] Application of the model to calculate risk measures.

As usual I only replicate the most basic issues,in this case a comparison of the fit across a host of models on the basis of the edhec data series from previous blog entries (as opposed to the broad market indices used in the paper).

To make this write up easier on me, this and subsequent posts shall deal with the following tasks :

  1. Provide a summary of the models examined by the paper.
  2. Provide a summary of the selection criteria (used to rank fitted results across models within and across fund returns).
  3. Attempt to make a custom ggplot table maker function to simplify text plotting.
  4. Load the edhec data set and store model results in a nested list object such that :
    • We fit 9 models to each of the 13 funds in the data set.
    • We store the estimated parameters and calculate values for chosen selection criteria for each model & fund combination.
    • We can access ILN model in fund CTA.Global by : Nested_List$CTA.Global$ILN.
  5. Save across models & remove problematic funds (funds that had strange values in the fitting process)  such that :
    •  We have a list object of 9 elements :
      • with each element being named after one of the 9 models.
      • with each element containing a data frame of non problematic funds and their selection criteria, formatted in a ggplot friendly way.
  6. Make a facet plot of Selection Criteria across non-problematic funds of the edhec dataset.
  7. Make a snap plot function for the chosen fund and selection criteria such that :
    • We provide a ranking of models for the particular fund and selection criteria combination in tabular as well as graphic form.
  8. Make a plot showing how often each model is the best performer across non-problematic funds.

 

[1] Summary of the models used

(1) The Independent Log Normal Model (ILN)

s1

(2) The First-order autoregressive model (AR1)

s2

(3) The autoregressive conditionally heteroskedastic model (ARCH1)

s3

(4) Combination of AR and ARCH model (AR.ARCH)

s4

(5) The generalized autoregressive conditionally heteroskedastic model (GARCH)

s5

(6) Combination of AR and GARCH model (AR.GARCH)

s7

(7) Regime Switching AR(1) model (AR.Reg2)

s8

(8) Regime Switching ILN model with 2 regimes (ILN.Reg2)

(9) Regime Switching ILN model with 3 regimes (ILN.Reg3)

 

[2] Summary of the Selection Criteria used

While the paper uses the (1) Likelihood ratio test, (2) Akaike Information Criterion and (3) Schwartz Bayes Criterion, I only used the the last two. The AIC uses the model that maximises the difference between the likelihood and the degree of freedom. The SBC uses the model that maximises the following :

lm

where I is the likelihood ; k the degree of freedom ; n the sample size ; j represents the model.

 

[3] Custom ggplot Table Maker

Since it is often useful to be able to plot tabular data on the fly,I have written a simple function for this purpose which allows one to specify typical elements of a basic table :

  • Is there a column and/or row?
  • What is the column title and/or row title?
  • What is the font for these titles?
  • What is the colour of the background of those titles?
  • What is the alpha value?
  • Is there a highlight for the column and/or row?
  • Which column and/or row should be highlighted?
  • What are the colours and alpha values for each highlight?

Mine is of course a fairly naive implementation,hardcoding certain coordinate adjustments instead of dynamically scaling them somehow (don’t know how) and only useful when there are not too many/little rows and columns. In any case,usage is fairly simple :

  1. Specify elements using the ggTableSpec function.
  2. Draw table using the ggTableDrawer function.

l

Example 1 : No highlighting whatsoever

l

  smpl.data <- data.frame(Col1=round(runif(20),3),Col2=round(runif(20),3),Col3=round(runif(20),3),Col4=round(runif(20),3),Col5=round(runif(20),3))
  rownames(smpl.data) <- paste('Row',1:20,sep='')

	smpl.spec <- ggTableSpec(columns.exist=T,columns.txt=colnames(smpl.data),columns.font=rep('bold',ncol(smpl.data)),columns.col='blue',columns.fill='grey',columns.alpha=0.7,
		                      rows.exist=T,rows.txt=rownames(smpl.data),rows.font=rep('bold',10),rows.col='green',rows.fill='blue',rows.alpha=0.7,
		                      data.obj=smpl.data,
		                    	hlt.col.exist=F,hl.col.which=c(1,5,20),hl.col.fill=c('lightgreen','darkgreen','red'),hl.col.alpha=c(0.4,0.4,0.4),
		                    	hlt.row.exist=F,hl.row.which=c(1,2,5),hl.row.fill=c('skyblue','red','yellow'),hl.row.alpha=c(0.4,0.4,0.4)
                )
  ggTableDrawer(smpl.spec)

a1

 

Example 2 : Column Highlighting
l

  smpl.data <- data.frame(Col1=round(runif(20),3),Col2=round(runif(20),3),Col3=round(runif(20),3),Col4=round(runif(20),3),Col5=round(runif(20),3))
  rownames(smpl.data) <- paste('Row',1:20,sep='')

	smpl.spec <- ggTableSpec(columns.exist=T,columns.txt=colnames(smpl.data),columns.font=rep('bold',ncol(smpl.data)),columns.col='blue',columns.fill='grey',columns.alpha=0.7,
		                      rows.exist=T,rows.txt=rownames(smpl.data),rows.font=rep('bold',10),rows.col='green',rows.fill='blue',rows.alpha=0.7,
		                      data.obj=smpl.data,
		                    	hlt.col.exist=F,hl.col.which=c(1,5,20),hl.col.fill=c('lightgreen','darkgreen','red'),hl.col.alpha=c(0.4,0.4,0.4),
		                    	hlt.row.exist=T,hl.row.which=c(1,2,5),hl.row.fill=c('skyblue','red','yellow'),hl.row.alpha=c(0.4,0.4,0.4)
                )
  ggTableDrawer(smpl.spec)

a2

Some alignment issues for the last column there.

 

Example 3 : Row Highlighting
l

  smpl.data <- data.frame(Col1=round(runif(20),3),Col2=round(runif(20),3),Col3=round(runif(20),3),Col4=round(runif(20),3),Col5=round(runif(20),3))
  rownames(smpl.data) <- paste('Row',1:20,sep='')

	smpl.spec <- ggTableSpec(columns.exist=T,columns.txt=colnames(smpl.data),columns.font=rep('bold',ncol(smpl.data)),columns.col='blue',columns.fill='grey',columns.alpha=0.7,
		                      rows.exist=T,rows.txt=rownames(smpl.data),rows.font=rep('bold',10),rows.col='green',rows.fill='blue',rows.alpha=0.7,
		                      data.obj=smpl.data,
		                    	hlt.col.exist=T,hl.col.which=c(1,5,20),hl.col.fill=c('lightgreen','darkgreen','red'),hl.col.alpha=c(0.4,0.4,0.4),
		                    	hlt.row.exist=F,hl.row.which=c(1,2,5),hl.row.fill=c('skyblue','red','yellow'),hl.row.alpha=c(0.4,0.4,0.4)
                )
  ggTableDrawer(smpl.spec)

a3

Again some alignment problems at the top and bottom. Maybe I will correct these issues later,for the time being I do not care. My suspicion is that the extreme coordinates for the column and row title panels are -/+ Inf whereas the coordinates for the highlights are not,hence their alignment should not be expected. Changing the Inf values to concrete ones should do the trick (maybe).

 

Example 4 : Row and Column Highlighting
l

 smpl.data <- data.frame(Col1=round(runif(20),3),Col2=round(runif(20),3),Col3=round(runif(20),3),Col4=round(runif(20),3),Col5=round(runif(20),3))
  rownames(smpl.data) <- paste('Row',1:20,sep='')

	smpl.spec <- ggTableSpec(columns.exist=T,columns.txt=colnames(smpl.data),columns.font=rep('bold',ncol(smpl.data)),columns.col='blue',columns.fill='grey',columns.alpha=0.7,
		                      rows.exist=T,rows.txt=rownames(smpl.data),rows.font=rep('bold',10),rows.col='green',rows.fill='blue',rows.alpha=0.7,
		                      data.obj=smpl.data,
		                    	hlt.col.exist=T,hl.col.which=c(1,5,20),hl.col.fill=c('lightgreen','darkgreen','red'),hl.col.alpha=c(0.4,0.4,0.4),
		                    	hlt.row.exist=T,hl.row.which=c(1,2,5),hl.row.fill=c('skyblue','red','yellow'),hl.row.alpha=c(0.4,0.4,0.4)
                )
  ggTableDrawer(smpl.spec)

l
a5Again same issues as above.Do not really see when i would want to highlight so many rows and columns anyways.

 

Example 5 : Problem

As an example of a problem consider the case where columns and rows do not exist but highlight do :
l

	smpl.spec <- ggTableSpec(columns.exist=F,columns.txt=colnames(smpl.data),columns.font=rep('bold',ncol(smpl.data)),columns.col='blue',columns.fill='grey',columns.alpha=0.7,
		                      rows.exist=F,rows.txt=rownames(smpl.data),rows.font=rep('bold',10),rows.col='green',rows.fill='blue',rows.alpha=0.7,
		                      data.obj=smpl.data,
		                    	hlt.col.exist=T,hl.col.which=c(1,5,20),hl.col.fill=c('lightgreen','darkgreen','red'),hl.col.alpha=c(0.4,0.4,0.4),
		                    	hlt.row.exist=T,hl.row.which=c(1,2,5),hl.row.fill=c('skyblue','red','yellow'),hl.row.alpha=c(0.4,0.4,0.4)
                )
  ggTableDrawer(smpl.spec)

l
dd

Clearly there are many issues that still need to be cleared up,but for the purposes of replicating the basic results of the paper I will leave the functions as they are for now. Instead of having me fumble around, I wish that the ggplot2 package creator would add table plotting functions to his package !

Leave a comment