Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/VFCI/fevdid
Browse files Browse the repository at this point in the history
  • Loading branch information
matdehaven committed Nov 9, 2023
2 parents 95418d3 + a3d3244 commit 60c3020
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 64 deletions.
88 changes: 41 additions & 47 deletions R/id_fevdfd.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
#' mvar <- id_fevdfd(v, "pi", c(2 * pi / 32, 2 * pi / 6))
#'
id_fevdfd <- function(
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1
) {
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1) {
UseMethod("id_fevdfd")
}

Expand All @@ -41,14 +40,13 @@ id_fevdfd <- function(
#'
#' @export
id_fevdfd.varest <- function(
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1
) {
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1) {
n <- colnames(x$y)
k <- length(n)
ni <- 1:k
Expand Down Expand Up @@ -114,14 +112,13 @@ id_fevdfd.varest <- function(
#'
#' @export
id_fevdfd.varboot <- function(
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1
) {
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1) {
id_fevdfd.varest(x, target, freqs, grid_size, freq_grid, sign, sign_horizon)
}

Expand All @@ -132,14 +129,13 @@ id_fevdfd.varboot <- function(
#'
#' @export
id_fevdfd.bvartools <- function(
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1
) {
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1) {
k <- nrow(x$y)
p <- ncol(x$A[, 1]) %% k
var_names <- rownames(x$y)
Expand Down Expand Up @@ -184,14 +180,13 @@ id_fevdfd.bvartools <- function(
#' @export
#'
id_fevdfd.bvar <- function(
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1
) {
x,
target,
freqs = c(0, 2 * pi),
grid_size = 1000,
freq_grid = NULL,
sign = "positive",
sign_horizon = 1) {
n <- colnames(x$meta$Y)
k <- length(n)
ni <- 1:k
Expand Down Expand Up @@ -280,13 +275,12 @@ id_fevdfd.bvar <- function(
#' @return matrix q
#'
id_fevdfd_findq <- function(
betas,
sigma,
target_index,
freqs,
grid_size,
freq_grid = NULL
) {
betas,
sigma,
target_index,
freqs,
grid_size,
freq_grid = NULL) {
## Construct Objects
k <- nrow(sigma)
ti <- target_index
Expand Down
29 changes: 12 additions & 17 deletions R/irffd.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ irffd <- function(var, ...) {
#' @return list with vector of frequencies and matrix of irf values
#'
irffd_generic <- function(
var,
freqs = c(0, 2 * pi),
grid_size = 1000
) {
var,
freqs = c(0, 2 * pi),
grid_size = 1000) {
n <- colnames(var$y)
k <- length(n)

Expand Down Expand Up @@ -92,12 +91,10 @@ irffd_generic <- function(
#' @export
#'
irffd.fevdvar <- function(
var,
freqs = c(0, 2 * pi),
grid_size = 1000,
...
) {

var,
freqs = c(0, 2 * pi),
grid_size = 1000,
...) {
k <- var$K

irffd <- irffd_generic(var, freqs, grid_size)
Expand Down Expand Up @@ -131,12 +128,10 @@ irffd.fevdvar <- function(
#' @export
#'
irffd.svars <- function(
var,
freqs = c(0, 2 * pi),
grid_size = 1000,
...
) {

var,
freqs = c(0, 2 * pi),
grid_size = 1000,
...) {
k <- var$K

irffd <- irffd_generic(var, freqs, grid_size)
Expand All @@ -156,4 +151,4 @@ irffd.svars <- function(
class(irffd) <- "irffd"

return(irffd)
}
}

0 comments on commit 60c3020

Please sign in to comment.