hit.ratio {fDMA} | R Documentation |
Computes Hit Ratio (HR) for Forecast.
Description
Sometimes it is interesting to analyze just whether the forecast can predict the direction of a change in a modelled time-series. This function computes the proportion of correctly predicted signs (i.e., in which cases the direction of a change given by forecast agrees with the change in real data).
Usage
hit.ratio(y,y.hat,d=NULL)
Arguments
y |
|
y.hat |
|
d |
optional, |
Value
References
Baur, D. G., Beckmann, J., Czudaj, R., 2016. A melting pot – Gold price forecasts under model and parameter uncertainty. International Review of Financial Analysis 48, 282–291.
Examples
wti <- crudeoil[-1,1]
drivers <- (lag(crudeoil[,-1],k=1))[-1,]
ld.wti <- (diff(log(wti)))[-1,]
ld.drivers <- (diff(log(drivers)))[-1,]
m1 <- fDMA(y=wti,x=drivers,alpha=0.99,lambda=0.99,initvar=10)
hit.ratio(y=wti,y.hat=m1$y.hat)
m2 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.99,initvar=10)
hit.ratio(y=ld.wti,y.hat=m2$y.hat,d=TRUE)