diff --git a/R/biokinetics.R b/R/biokinetics.R index e93e1e1..d7f57eb 100644 --- a/R/biokinetics.R +++ b/R/biokinetics.R @@ -167,10 +167,10 @@ biokinetics <- R6::R6Class( preds_sd = private$preds_sd, K = private$data[, data.table::uniqueN(titre_type)], N_uncens = private$data[censored == 0, .N], - N_lo = private$data[censored == -2, .N], + N_lo = private$data[censored == -1, .N], N_hi = private$data[censored == 1, .N], uncens_idx = private$data[censored == 0, obs_id], - cens_lo_idx = private$data[censored == -2, obs_id], + cens_lo_idx = private$data[censored == -1, obs_id], cens_hi_idx = private$data[censored == 1, obs_id]) stan_data$t <- private$data[, time_since_last_exp] diff --git a/tests/snapshots/test-snapshots b/tests/snapshots/test-snapshots index b11367a..6956434 100755 --- a/tests/snapshots/test-snapshots +++ b/tests/snapshots/test-snapshots @@ -2,4 +2,4 @@ set -ex docker build . -f snapshot-tests.Dockerfile -t epikinetics-test -docker run epikinetics-test Rscript -e "devtools::test(filter='snapshot')" +docker run epikinetics-test Rscript -e "res=devtools::test(filter='snapshot');df=as.data.frame(res);if(sum(df\$failed) > 0 || any(df\$error)) {q(status=1)}" diff --git a/tests/testthat/_snaps/snapshots.md b/tests/testthat/_snaps/snapshots.md index 0798161..9de6093 100644 --- a/tests/testthat/_snaps/snapshots.md +++ b/tests/testthat/_snaps/snapshots.md @@ -4,27 +4,27 @@ delta Output variable mean median sd mad q5 q95 rhat ess_bulk - lp__ -1195.29 -1182.41 78.03 45.74 -1340.68 -1107.94 1.07 48 - t0_pop[1] 4.80 4.79 0.24 0.24 4.45 5.21 1.04 97 - t0_pop[2] 4.12 4.11 0.25 0.27 3.75 4.57 1.02 233 - t0_pop[3] 3.52 3.52 0.26 0.27 3.10 3.92 1.02 205 - tp_pop[1] 10.72 10.73 0.60 0.60 9.81 11.68 1.01 304 - tp_pop[2] 9.55 9.55 0.64 0.65 8.61 10.57 1.01 349 - tp_pop[3] 8.88 8.87 0.77 0.80 7.68 10.09 1.02 250 - ts_pop_delta[1] 61.55 61.45 2.61 2.60 57.50 65.70 1.00 203 - ts_pop_delta[2] 52.55 52.44 2.56 2.50 48.64 56.37 1.01 304 - ts_pop_delta[3] 50.10 50.10 2.65 2.51 45.80 54.36 1.02 173 + lp__ -2109.08 -2109.36 46.47 43.82 -2188.94 -2029.83 1.04 77 + t0_pop[1] 4.26 4.26 0.28 0.30 3.81 4.74 1.00 350 + t0_pop[2] 2.53 2.52 0.31 0.33 2.02 3.03 1.01 344 + t0_pop[3] 1.47 1.48 0.32 0.35 0.94 2.02 1.00 351 + tp_pop[1] 8.66 8.65 0.62 0.60 7.70 9.66 1.01 367 + tp_pop[2] 9.14 9.13 0.65 0.63 8.12 10.20 1.00 286 + tp_pop[3] 9.38 9.36 0.70 0.72 8.32 10.56 1.00 319 + ts_pop_delta[1] 59.90 59.89 2.46 2.29 56.07 64.51 1.01 403 + ts_pop_delta[2] 48.89 48.89 3.13 3.20 43.53 54.03 1.00 329 + ts_pop_delta[3] 43.53 43.59 2.87 2.90 38.78 48.10 1.01 196 ess_tail - 20 - 351 - 248 - 359 - 415 - 412 - 203 - 239 - 330 - 341 + 168 + 317 + 301 + 397 + 414 + 286 + 362 + 375 + 371 + 262 # showing 10 of 10103 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option) @@ -33,19 +33,19 @@ Code trajectories Output - time_since_last_exp me lo hi titre_type - - 1: 0 120.1929 93.3773 154.1345 Ancestral - 2: 1 150.4494 118.7096 186.3689 Ancestral - 3: 2 187.4234 152.6142 227.3441 Ancestral - 4: 3 233.3859 192.6505 280.5822 Ancestral - 5: 4 291.5457 244.1629 346.3841 Ancestral - --- - 902: 146 160.6464 127.8557 205.7500 Delta - 903: 147 159.9748 127.1635 204.8898 Delta - 904: 148 159.2377 126.6307 204.0333 Delta - 905: 149 158.5859 126.1045 203.1803 Delta - 906: 150 157.9107 125.5806 202.4049 Delta + time_since_last_exp me lo hi titre_type + + 1: 0 85.50469 61.58522 114.4462 Ancestral + 2: 1 117.88403 89.33763 155.4831 Ancestral + 3: 2 161.88338 125.71051 211.4578 Ancestral + 4: 3 221.63832 177.37863 287.5669 Ancestral + 5: 4 304.82979 242.45015 390.8075 Ancestral + --- + 902: 146 114.71590 82.31486 153.4804 Delta + 903: 147 114.07370 81.57447 152.6794 Delta + 904: 148 113.43508 80.95385 152.0921 Delta + 905: 149 112.89102 80.55711 151.5578 Delta + 906: 150 112.35549 80.06288 151.0253 Delta infection_history 1: Infection naive @@ -65,17 +65,17 @@ Code trajectories Output - calendar_day titre_type me lo hi time_shift - - 1: 2021-03-08 Ancestral 1172.55130 909.767640 1501.3053 0 - 2: 2021-03-09 Ancestral 1151.63927 882.770140 1488.7275 0 - 3: 2021-03-10 Ancestral 1184.73564 910.075137 1566.1617 0 - 4: 2021-03-11 Ancestral 1136.15980 888.320759 1485.9868 0 - 5: 2021-03-12 Ancestral 1153.10110 875.290893 1506.4791 0 - --- - 1775: 2022-08-07 Delta 84.12329 11.738509 387.2564 0 - 1776: 2022-08-08 Delta 84.26154 10.517460 382.8336 0 - 1777: 2022-08-09 Delta 85.79343 10.647211 386.2053 0 - 1778: 2022-08-10 Delta 85.99704 9.774407 385.3051 0 - 1779: 2022-08-11 Delta 84.49904 11.370238 395.8927 0 + calendar_day titre_type me lo hi time_shift + + 1: 2021-03-08 Ancestral 1130.6519 886.46528 1515.564 0 + 2: 2021-03-09 Ancestral 1111.4907 870.98406 1445.181 0 + 3: 2021-03-10 Ancestral 1162.5233 910.19435 1502.363 0 + 4: 2021-03-11 Ancestral 1096.5356 863.12051 1428.106 0 + 5: 2021-03-12 Ancestral 1092.3590 841.37625 1455.778 0 + --- + 1775: 2022-08-07 Delta 327.5756 43.51063 3757.989 0 + 1776: 2022-08-08 Delta 332.4900 44.09745 3769.825 0 + 1777: 2022-08-09 Delta 328.4756 44.39750 3789.218 0 + 1778: 2022-08-10 Delta 330.0316 44.69789 3862.426 0 + 1779: 2022-08-11 Delta 337.2001 42.71692 3877.397 0