## Simple example
res <- with(stockprice, tcor(x = SP500, y = FTSE100, t = DateID, h = 50, CI = TRUE))
test_equality(res)
## Chi2 instead of Student's t-test
test_equality(res, test = "chi2")
## Time point can be dates or indices (mixing possible) but output as in input data
test_equality(res, t1 = "2000-04-04", t2 = 1000)
res[1000, "t"] ## t2 matches with date in `res`
stockprice[1000, "DateID"] ## t2 does not match with date `stockprice` due to missing values
## It could be useful to use `keep.missing = TRUE` for index to match original data despite NAs
res2 <- with(stockprice, tcor(x = SP500, y = FTSE100, t = DateID,
h = 50, CI = TRUE, keep.missing = TRUE))
test_equality(res2, t1 = "2000-04-04", t2 = 1000)
res[1000, "t"] ## t2 matches with date in `res`
stockprice[1000, "DateID"] ## t2 does match with date `stockprice` despite missing values
Run the code above in your browser using DataLab