Skip to content

Commit

Permalink
unit tests for aic & bic
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyCHoover committed Jan 15, 2025
1 parent b7d666c commit 540365b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/testthat/test-utils-model-evaluation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
test_that("aic works", {
num_params <- 101
logLik <- -18474.98

Check warning on line 3 in tests/testthat/test-utils-model-evaluation.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils-model-evaluation.R,line=3,col=3,[object_name_linter] Variable and function name style should match snake_case or symbols.

exp_aic <- (-2 * logLik) + (2 * num_params)
aic_val <- aic(rstn_dino)

expect_equal(exp_aic, aic_val)
})

test_that("bic works", {
num_params <- 101
N <- 1000

Check warning on line 13 in tests/testthat/test-utils-model-evaluation.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils-model-evaluation.R,line=13,col=3,[object_name_linter] Variable and function name style should match snake_case or symbols.
logLik <- -18474.98

Check warning on line 14 in tests/testthat/test-utils-model-evaluation.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils-model-evaluation.R,line=14,col=3,[object_name_linter] Variable and function name style should match snake_case or symbols.

exp_bic <- (-2 * logLik) + (log(N) * num_params)
bic_val <- bic(rstn_dino)

expect_equal(exp_bic, bic_val)
})

0 comments on commit 540365b

Please sign in to comment.