KL: Kullback-Leibler (KL) information

Description Usage Arguments Value Examples

View source: R/KL.R

Description

A approach to separate leading, consistent, lagging indicators from economic indicators.

Usage

1
KL(base, divergent, lag = 12, group_lag = 3)

Arguments

base

a numeric vector, containing a basic indicator for comparing to other indicators in order to recognize who is leading indicator ...

divergent

a data frame containing indicators to be compared with base , and then to divide to 3 data frame, storing lagging, convenient, lagging indicators respectively.

lag

max lag (forward or afterward) for calculating KL information, at range of [-lag, lag].

group_lag

threshold value of lag for divide different indicator, default is 3, means that lagging or leading lag at range of [-3, 3] will group the indicator to consistent indicator.

Value

A list includes some value as follow :

Coincident_Indicator

data frame, including coincident indicator

Leading_Indicator

data frame, including leading indicator

Lagging_Indicator

data frame, lagging indicator

KL_Matrix

matrix including KL value and lag information

KL_Min

data frame, including vector of KL_lag : lag corresponding min KL value and vector of KL_min : min KL value

Examples

1
2
3
4
5
x1 <- c( 5, 9, 5, 12, 13, 8, 14, 14, 8, 10)
x2 <- c( 9, 15, 5, 14, 8, 6, 12, 19,8, 7)
base<-c( 26, 13, 25, 27 ,25 ,13 ,32 ,20 ,23 ,29)
dt<-data.frame(x1, x2, base)
KL(base,dt,lag = 3,group_lag = 1)

Nisus-Liu/CompositeIndex documentation built on May 7, 2019, 6:18 p.m.