Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Oct 11, 2023
2 parents becc67d + 38900b5 commit 2b0b86b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/ar.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ estimate_ar <- function(x, p, xreg, constant, fixed) {
coef.se = coef_se,
fits = c(rep.int(NA_real_, p), YH),
resid = c(rep.int(NA_real_, p), E),
reg_resid = x - xm*x_sd,
reg_resid = x - xm,
last = x[(length(E)+1):length(x)],
sigma2 = drop(varE),
aic = aic,
Expand Down Expand Up @@ -283,14 +283,14 @@ generate.AR <- function(x, new_data = NULL, specials = NULL,

# Predict xreg
nx <- length(coef) - p
ar <- coef[nx + seq_len(p)]
if (!is.null(xreg)) {
xcoef <- coef[seq_len(nx)]
xm <- drop(xreg %*% xcoef)
xm <- drop(xreg %*% xcoef) / (1 - sum(ar))
} else {
xm <- rep(0, nrow(new_data))
}

ar <- coef[nx + seq_len(p)]
# Generate future innovations if missing
if(!(".innov" %in% names(new_data))){
if(bootstrap){
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-rw.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ test_that("SNAIVE", {
# fable_fc_sim$value
# )

skip_if_not_installed("tsibbledata")
expect_warning(
tsibbledata::vic_elec %>%
tsibble::index_by(date = as.Date(Time)) %>%
Expand Down

0 comments on commit 2b0b86b

Please sign in to comment.