Closed espher1987 closed 2 years ago
Thanks for raising this issue - it's a bug.
The x-axis is reversed here because x
was passed to y
and vice-versa, since CCF()
uses CCF(y,x)
compared to ccf(x,y)
.
I've now fixed this.
library(vars)
#> Loading required package: MASS
#> Loading required package: strucchange
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
#> Loading required package: sandwich
#> Loading required package: urca
#> Loading required package: lmtest
library(tidyr)
library(feasts)
#> Loading required package: fabletools
data("Canada")
df <- Canada %>%
diff %>%
as_tsibble() %>%
pivot_wider(id_cols = index,names_from = key,values_from = value)
with(as.data.frame(diff(Canada)),
ccf(y = ts(e),
x = ts(prod),lag.max = 4))
df %>%
CCF(y = e,
x = prod,lag_max = 4) %>%
autoplot()
Created on 2022-08-25 by the reprex package (v2.0.1)
Hi to everyone, i'm new using the feast package but i wonder if this correct, i'm trying to verify a cross correlation so i have:
At this point i define
y = e
andx = prod
When i set this same variables to
stats::ccf
andforecasts::Ccf
and compare tofeasts::CCF
This first two plots give the contrary direction to
feasts::CCF
, Why this happens?Created on 2021-11-22 by the reprex package (v2.0.1)
Thanks for this amazing project. I appreciate this!
Info: R version 4.0.4 (2021-02-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 11 (bullseye) feasts_0.2.2
tsibble_1.0.1 fabletools_0.3.1 forecast_8.13
EDIT: I edit this post to use reprex package