You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
person("François", "Rousset", role = "aut", comment = c(ORCID = "0000-0003-4670-0371")))
7
7
Description:
8
8
Computes how the correlation between 2 time-series changes over time.
9
-
To do so, the package performs a non-parametric kernel smoothing (using a common bandwidth) of all underlying components required for the computation of a correlation coefficient (i.e., x, y, x^2, y^2, xy).
9
+
To do so, the package follows the method from Choi & Shin (2021) <doi:10.1007/s42952-020-00073-6>.
10
+
It performs a non-parametric kernel smoothing (using a common bandwidth) of all underlying components required for the computation of a correlation coefficient (i.e., x, y, x^2, y^2, xy).
10
11
An automatic selection procedure for the bandwidth parameter is implemented.
11
12
Alternative kernels can be used (Epanechnikov, box and normal).
12
13
Both Pearson and Spearman correlation coefficients can be estimated and change in correlation over time can be tested.
Copy file name to clipboardExpand all lines: R/CI.R
+41-51Lines changed: 41 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
#' Internal functions for the computation of confidence intervals
2
2
#'
3
-
#' These functions compute the different terms required to compute the confidence
4
-
#' interval around the time-varying correlation coefficient.
3
+
#' These functions compute the different terms required for [`tcor()`] to compute the confidence
4
+
#' interval around the time-varying correlation coefficient. These terms are defined in Choi & Shin (2021).
5
5
#'
6
-
#' @seealso [`tcor`]
6
+
#' @seealso [`tcor()`]
7
7
#' @name CI
8
8
#'
9
9
#' @references
@@ -13,6 +13,15 @@
13
13
#' Andrews, D. W. K. Heteroskedasticity and autocorrelation consistent covariance matrix estimation.
14
14
#' Econometrica: Journal of the Econometric Society, 817-858 (1991).
15
15
#'
16
+
#' @return
17
+
#' - `calc_H()` returns a 5 x 5 x \eqn{t} array of elements of class numeric, which corresponds to \eqn{\hat{H_t}} in Choi & Shin (2021).
18
+
#' - `calc_e()` returns a \eqn{t} x 5 matrix of elements of class numeric storing the residuals, which corresponds to \eqn{\hat{e}_t} in Choi & Shin (2021).
19
+
#' - `calc_Gamma()` returns a 5 x 5 matrix of elements of class numeric, which corresponds to \eqn{\hat{\Gamma}_l} in Choi & Shin (2021).
20
+
#' - `calc_GammaINF()` returns a 5 x 5 matrix of elements of class numeric, which corresponds to \eqn{\hat{\Gamma}^\infty} in Choi & Shin (2021).
21
+
#' - `calc_L_And()` returns a scalar of class numeric, which corresponds to \eqn{L_{And}} in Choi & Shin (2021).
22
+
#' - `calc_D()` returns a \eqn{t} x 5 matrix of elements of class numeric storing the residuals, which corresponds to \eqn{D_t} in Choi & Shin (2021).
23
+
#' - `calc_SE()` returns a vector of length \eqn{t} of elements of class numeric, which corresponds to \eqn{se(\hat{\rho}_t(h))} in Choi & Shin (2021).
24
+
#'
16
25
#' @examples
17
26
#' rho_obj <- with(na.omit(stockprice),
18
27
#' calc_rho(x = SP500, y = FTSE100, t = DateID, h = 20, kernel = "box"))
@@ -21,18 +30,16 @@
21
30
NULL
22
31
23
32
24
-
#' @describeIn CI Internal function computing the `$\hat{H_t}$` array.
33
+
#' @describeIn CI computes the \eqn{\hat{H_t}} array.
25
34
#'
26
-
#' `$\hat{H_t}$` is a component needed to compute confidence intervals;
27
-
#' `$H_t$` is defined in eq. 6 from Choi & Shin, 2021.
28
-
#' The function returns a 5 x 5 x `t` array.
35
+
#' \eqn{\hat{H_t}} is a component needed to compute confidence intervals;
36
+
#' \eqn{H_t} is defined in eq. 6 from Choi & Shin (2021).
29
37
#'
30
38
#' @export
31
39
#' @param smoothed_obj an object created with [`calc_rho`].
32
40
#'
33
41
#' @examples
34
-
#'
35
-
#' ## Computing `$\hat{H_t}$`
42
+
#' ## Computing \eqn{\hat{H_t}}
36
43
#'
37
44
#' H <- calc_H(smoothed_obj = rho_obj)
38
45
#' H[, , 1:2] # H array for the first two time points
#' @describeIn CI Internal function computing `$L_{And}$`.
146
+
#' @describeIn CI computes \eqn{L_{And}}.
149
147
#'
150
-
#' `$L_{And}$` is a component needed to compute confidence intervals;
151
-
#' it is defined in Choi & Shin, 2021, p 342.
152
-
#' It also corresponds to `$S_T^*$`, eq 5.3 in Andrews 1991.
153
-
#' The function returns a scalar which should be used as an input for `L` in [`calc_GammaINF`].
148
+
#' \eqn{L_{And}} is defined in Choi & Shin (2021, p 342).
149
+
#' It also corresponds to \eqn{S_T^*}, eq 5.3 in Andrews (1991).
154
150
#'
155
151
#' @export
156
-
#' @param AR.method character string specifying the method to fit the autoregressive model used to compute `$\hat{\gamma}_1$` in `$L_{And}$` (see [`stats::ar`] for details).
152
+
#' @param AR.method character string specifying the method to fit the autoregressive model used to compute \eqn{\hat{\gamma}_1} in \eqn{L_{And}} (see [`stats::ar`] for details).
0 commit comments