Skip to content

Commit

Permalink
Added a simple test for the predict_growth_rate function
Browse files Browse the repository at this point in the history
  • Loading branch information
telkamp7 committed Oct 23, 2023
1 parent 35ae19c commit 211d483
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
20 changes: 14 additions & 6 deletions man/predict_growth_rate.Rd

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

32 changes: 32 additions & 0 deletions tests/testthat/test-predict_growth_rate.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
test_that("Returns the desired length", {
# Generate some sample data
tsd_data <- tsd(
observed = c(100, 120, 150, 180, 220, 270),
time = as.Date(c(
"2023-01-01",
"2023-01-02",
"2023-01-03",
"2023-01-04",
"2023-01-05",
"2023-01-06"
)),
time_interval = "day"
)

# Employ the aedseo function
aedseo_results <- aedseo(
tsd = tsd_data,
k = 3,
level = 0.95,
family = "poisson"
)

# Make a 5 step prediction
n_step <- 5

# Predict growth rates for the next 5 time steps
prediction <- predict_growth_rate(object = aedseo_results, n_step = n_step)

# Return the number of prediction + the initial observation
expect_length(prediction$estimate, n_step + 1)
})

0 comments on commit 211d483

Please sign in to comment.