Skip to content

Commit

Permalink
added prints to car tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielturek committed Feb 5, 2024
1 parent 3d84110 commit 7de254b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nimbleHMC/tests/testthat/test-HMC.R
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,17 @@ test_that('HMC results for CAR match non-HMC', {
Cmcmc <- compileNimble(Rmcmc, project = Rmodel)
outHMC <- runMCMC(Cmcmc, niter = 22000, nburnin=2000, thin=20)

a <- apply(out[,1:6],2,mean)
b <- apply(outHMC[,1:6],2,mean)
print(a)
print(b)
print(abs(a-b))
expect_equal(apply(out[,1:6],2,mean), apply(outHMC[,1:6],2,mean), tolerance = .05)
a <- mean(out[,7])
b <- mean(outHMC[,7])
print(a)
print(b)
print(abs(a-b))
expect_equal(mean(out[,7]),mean(outHMC[,7]), tolerance = .15)

expect_equal(apply(out,2,quantile,c(.1,.9)), apply(outHMC,2,quantile,c(.1,.9)), tolerance = 0.15)
Expand Down

0 comments on commit 7de254b

Please sign in to comment.