hit.ratio: Computes Hit Ratio (HR) for Forecast.

hit.ratioR 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

numeric, vector, or one row or one column matrix or xts object, representing a forecasted time-series

y.hat

numeric, vector, or one row or one column matrix or xts object, representing forecast predictions

d

optional, logical, d=FALSE for level time-series, d=TRUE if time-series already represent changes, by default d=FALSE

Value

numeric

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 <- drivers[-1,]
ld.drivers[,c(4,6)] <- (diff(drivers[,c(4,6)]))[-1,]
ld.drivers[,c(1:2,5,7)] <- (diff(log(drivers[,c(1:2,5,7)])))[-1,]
ld.drivers[,c(3,6)] <- ld.drivers[,c(3,6)]/100

m1 <- fDMA(y=wti,x=drivers[,5:7],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)



fDMA documentation built on April 4, 2025, 5:16 a.m.

Related to hit.ratio in fDMA...