1234567891011121314151617 |
- #!/usr/bin/env Rscript
- library(grangers)
- library(RcppCNPy)
- signal_mat <- npyLoad('../data/time_series_small.npy')
- x <- signal_mat[1, ]
- y <- signal_mat[2, ]
- GC <- Granger.unconditional(x, y, ic.chosen='AIC', max.lag=4, plot=F)
- frequency <- GC$frequency
- gc_x_y <- GC$Unconditional_causality_x.to.y
- gc_y_x <- GC$Unconditional_causality_y.to.x
- result_df <- data.frame(frequency, gc_x_y, gc_y_x)
- gc_matrix <- as.matrix(result_df)
- npySave("../data/gc_matrix.npy", gc_matrix)
|