Skip to content

Commit

Permalink
Use pruning parameter in VAR example
Browse files Browse the repository at this point in the history
  • Loading branch information
doccstat committed Mar 18, 2024
1 parent faf8bac commit deb0ae5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions man/fastcpd_var.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/testthat/examples/fastcpd_var.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
set.seed(1)
n <- 800
n <- 300
p <- 2
theta_1 <- matrix(c(-0.3, 0.6, -0.5, 0.4, 0.2, 0.2, 0.2, -0.2), nrow = p)
theta_2 <- matrix(c(0.3, -0.4, 0.1, -0.5, -0.5, -0.2, -0.5, 0.2), nrow = p)
x <- matrix(0, n + 2, p)
for (i in 1:500) {
for (i in 1:200) {
x[i + 2, ] <- theta_1 %*% c(x[i + 1, ], x[i, ]) + rnorm(p, 0, 1)
}
for (i in 501:n) {
for (i in 201:n) {
x[i + 2, ] <- theta_2 %*% c(x[i + 1, ], x[i, ]) + rnorm(p, 0, 1)
}
result <- fastcpd.var(x, 2, cost_adjustment = NULL)
result <- fastcpd.var(x, 2, pruning = FALSE)
summary(result)
2 changes: 1 addition & 1 deletion tests/testthat/test-examples-fastcpd_var.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
testthat::test_that(
"examples/fastcpd_var.R", {
source("examples/fastcpd_var.R")
testthat::expect_equal(result@cp_set, 518)
testthat::expect_equal(result@cp_set, 204)
}
)

0 comments on commit deb0ae5

Please sign in to comment.