Skip to content

Commit

Permalink
Fix VECM with constants and AR(p=0)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Oct 1, 2024
1 parent 61adae7 commit 760b93e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/vecm.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
train_vecm <- function(.data, specials, ic, ...) {
# Get args
p <- specials$AR[[1]]$p

# Get response variables
y <- invoke(cbind, unclass(.data)[measured_vars(.data)])

Expand All @@ -29,11 +29,11 @@ estimate_vecm <- function(y, p, sr_xreg, constant, r, ...) {
}

dy <- diff(y)
if (p > 0) {
# if (p > 0) {
# y <- y[-seq_len(p), , drop = FALSE]
# dy <- dy[-seq_len(p), , drop = FALSE]
sr_xreg <- sr_xreg[-seq_len(p + 1), , drop = FALSE]
}
# }
sr_xreg <- sr_xreg[-seq_len(p + 1), , drop = FALSE]

y_embed <- stats::embed(y, dimension = p + 1)
dy_embed <- stats::embed(dy, dimension = p + 1)
Expand Down

0 comments on commit 760b93e

Please sign in to comment.