[R-sig-Finance] tests for superior predictive ability?

Guy Yollin gyollin at insightful.com
Tue Jun 6 17:37:22 CEST 2006


Monty,

I'd also be interested in either of the diagnostics you mentioned.

In the meantime, perhaps the following would be of help to you.  It's an
implementation of a forecast directional accuracy test described in Tsay,
2002, section 4.4.2.1

# NAME:        DMtest.s
# DESCRIPTION: directional measure test
# REFERENCE:   Tsay, Analysis of Financial Time Series , 2002
# 
# args:  actual & forecast should be vectors of 1 and -1 indicating
#        positive and negative forecasts, respectively
DM.test <- function(actual,forecast)
{
  m.tab <-
matrix(NA,nrow=3,ncol=3,dimnames=list(as.character(1:3),as.character(1:3)))

  m.tab[1,1] <- sum(actual>=0 & forecast>=0)
  m.tab[1,2] <- sum(actual>=0 & forecast<0)
  m.tab[1,3] <- sum(actual>=0)
  m.tab[2,1] <- sum(actual<0 & forecast>=0)
  m.tab[2,2] <- sum(actual<0 & forecast<0)
  m.tab[2,3] <- sum(actual<0)
  m.tab[3,1] <- sum(forecast>=0)
  m.tab[3,2] <- sum(forecast<0)
  m.tab[3,3] <- numRows(actual)
  stat <- 0
  for( k in 1:2 )
  {
    for( l in 1:2 )
    {
      stat <- stat +
(m.tab[k,l]-m.tab[k,3]*m.tab[3,l]/m.tab[3,3])^2/(m.tab[k,3]*m.tab[3,l]/m.tab[
3,3])
    }
  }
  pc <- (m.tab[1,1]+m.tab[2,2])/m.tab[3,3]
  stat <- round(stat,digits=3)
  p.value <- round(1-pchisq(stat,df=1),digits=3)
  return(list(percent.correct=pc,statistic=stat,p.value=p.value))
}

Best,

-- Guy




-----Original Message-----
From: Monty B. [mailto:montezumasrevenge at gmail.com] 
Sent: Tuesday, June 06, 2006 4:40 AM
To: r-sig-finance at stat.math.ethz.ch
Subject: [R-sig-Finance] tests for superior predictive ability?

Dear list,

Does anyone know of an implementation of either
- reality check (RC) of White 2000 (Econometrica)
- superior predictive ability (SPA) of Hansen 2005  (J of Bus and Ec
Statistics)

in R or S-plus?

Cheers,

Monty

	[[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance



More information about the R-SIG-Finance mailing list