cointegration_p_matrix: Get the pairwise matrix of p-values testing for cointegration

Description Usage Arguments Value Examples

View source: R/cointegration.r

Description

Get the pairwise matrix of p-values testing for cointegration

Usage

1

Arguments

x

a data.frame, matrix, or xts object

Value

An upper triangular matrix where each entry corresponds to the p-value from McKinnons's test assuming no time trend. Note that if one stock in a pair-wise cointegration is constant the return value will be 1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(aapl_fix)
data(a_fix)
aapl_cons = consolidate_prices(aapl_fix$sys_date, aapl_fix$sys_time,
 aapl_fix$td_price, aapl_fix$td_size)
a_cons = consolidate_prices(a_fix$sys_date, a_fix$sys_time,
 a_fix$td_price, a_fix$td_size)
trades = merge(aapl_cons$price, a_cons$price)
trades = carry_prices_forward(trades)
names(trades) = c("aapl", "a")
cointegration_p_matrix(trades)

hafen/nxcore documentation built on May 17, 2019, 2:03 p.m.