calc_cor: Calculate correlation between returns

Description Usage Arguments Value Examples

Description

Calculate correlation between returns

Usage

1
2
calc_cor(unwt_ret_df, start_date = NA, end_date = NA,
  period_name = NULL)

Arguments

unwt_ret_df

dataframe containing timeseries returns for each strategy

start_date

A Date variable which is the start_date of the period for correlation calculation

end_date

A Date variable

period_name

optional period_name to attach to the returned correlations

Value

long form dataframe (see tidyr::gather) containing correlation between returns, and 'period_name“ if provided

Examples

1
2
3
4
5
unwt_ret <- data.frame(date = as.Date(c("2018-01-02", "2018-01-03", "2018-01-04", "2018-01-05")),
                              long_spx = c(0.015, 0.021, -0.03, 0.01),
                              long_ukx = c(-0.005, 0.03, -0.01, -0.04),
                              long_hsi = c(0.023, 0.001, -0.005, 0.008))
calc_cor(unwt_ret)

yunching/tidymas documentation built on Nov. 17, 2019, 6:03 a.m.