Skip to content

Commit ee70347

Browse files
committed
Most tests pass now
1 parent bdd6c58 commit ee70347

14 files changed

+4979
-108
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# loo_predictive_metric is equal to snapshot
2+
3+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP+b6DHwJlO4AAAAOAAAAAT+0VQV434B0
4+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
5+
ZQAAAP4=
6+
7+
---
8+
9+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP/c/cc5N6ckAAAAOAAAAAT/C02/w8SU2
10+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
11+
ZQAAAP4=
12+
13+
---
14+
15+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP+r8D5W4BOIAAAAOAAAAAT+07COl+XlU
16+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
17+
ZQAAAP4=
18+
19+
---
20+
21+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP/qvkDt3DvwAAAAOAAAAAT/BcF2FCRTJ
22+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
23+
ZQAAAP4=
24+
25+
---
26+
27+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP+bBWsjIsVUAAAAOAAAAAT/BpKrAKkv4
28+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
29+
ZQAAAP4=
30+
31+
---
32+
33+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABQAZBDZS19iwAAAAOAAAAAT/dFfIrJ59T
34+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
35+
ZQAAAP4=
36+
37+
---
38+
39+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP9gAAAAAAAAAAAAOAAAAAT+16K3SNqWP
40+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
41+
ZQAAAP4=
42+
43+
---
44+
45+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP9QAAAAAAAAAAAAOAAAAAT+0+ea7xOyz
46+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
47+
ZQAAAP4=
48+
49+
---
50+
51+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP9aw32sN9rEAAAAOAAAAAT+uapXy8Hyq
52+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
53+
ZQAAAP4=
54+
55+
---
56+
57+
WAoAAAACAAQFAAACAwAAAAITAAAAAgAAAA4AAAABP+AAAAAAAAAAAAAOAAAAAQAAAAAAAAAA
58+
AAAEAgAAAAEABAAJAAAABW5hbWVzAAAAEAAAAAIABAAJAAAACGVzdGltYXRlAAQACQAAAAJz
59+
ZQAAAP4=
60+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# loo_compare_subsample
2+
3+
Code
4+
lcss <- loo:::loo_compare.psis_loo_ss_list(x = list(lss1, lss2, lss3))
5+
Condition
6+
Warning:
7+
Different subsamples in 'model3' and 'model2'. Naive diff SE is used.
8+
Warning:
9+
Different subsamples in 'model3' and 'model1'. Naive diff SE is used.
10+
11+
---
12+
13+
Code
14+
lcssapi <- loo_compare(lss1, lss2, lss3)
15+
Condition
16+
Warning:
17+
Different subsamples in 'model3' and 'model2'. Naive diff SE is used.
18+
Warning:
19+
Different subsamples in 'model3' and 'model1'. Naive diff SE is used.
20+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# loo_model_weights (stacking and pseudo-BMA) gives expected result
2+
3+
WAoAAAACAAQFAAACAwAAAAAOAAAAAz/KEXngFjO6P+l7oXTIUDU+YzIi3AAAAA==
4+
5+
---
6+
7+
WAoAAAACAAQFAAACAwAAAAAOAAAAAz+xA6UGtqDFP+3eFS5zKzY/J2MLYAsc4w==
8+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# mcse_loo extractor gives correct value
2+
3+
WAoAAAACAAQFAAACAwAAAAAOAAAAAT+2J8YDcP5s
4+

tests/testthat/_snaps/psis.md

Lines changed: 4801 additions & 0 deletions
Large diffs are not rendered by default.

tests/testthat/_snaps/psislw.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# psislw handles special cases, throws appropriate errors/warnings
2+
3+
Code
4+
psis <- psislw(x[, 1], wcp = 0.01)
5+
Condition
6+
Warning in `psislw()`:
7+
'psislw' is deprecated.
8+
Use 'psis' instead.
9+
See help("Deprecated")
10+
Warning:
11+
All tail values are the same. Weights are truncated but not smoothed.
12+
Warning:
13+
Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.
14+

tests/testthat/test_loo_subsampling.R

Lines changed: 63 additions & 73 deletions
Large diffs are not rendered by default.

tests/testthat/test_model_weighting.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
library(loo)
22

3-
context("loo_model_weights")
4-
53
# generate fake data
64
set.seed(123)
75
y<-rnorm(50,0,1)
@@ -22,7 +20,7 @@ loo_list <- lapply(1:length(ll_list), function(j) {
2220
loo(ll_list[[j]], r_eff = r_eff_list[[j]])
2321
})
2422

25-
tol <- 0.01 # absoulte tolerance of weights
23+
tol <- 0.01 # absolute tolerance of weights
2624

2725
test_that("loo_model_weights throws correct errors and warnings", {
2826
expect_error(loo_model_weights(log_lik1), "list of matrices or a list of 'psis_loo' objects")
@@ -79,7 +77,7 @@ test_that("loo_model_weights (stacking and pseudo-BMA) gives expected result", {
7977
expect_length(w3, 3)
8078
expect_named(w3, paste0("model" ,c(1:3)))
8179
expect_equal(as.numeric(w3), c(5.365279e-05, 9.999436e-01, 2.707028e-06),
82-
tolerance = tol, scale = 1)
80+
tolerance = tol)
8381
expect_output(print(w3), "Method: pseudo-BMA")
8482

8583
w3_b <- loo_model_weights(loo_list, method = "pseudobma", BB = FALSE)

tests/testthat/test_pointwise.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
library(loo)
22

3-
context("pointwise convenience function")
4-
53
loo1 <- suppressWarnings(loo(example_loglik_matrix()))
64

75
test_that("pointwise throws the right errors", {

tests/testthat/test_print_plot.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
library(loo)
22
set.seed(1414)
33

4-
context("print, plot, diagnostics")
5-
64
LLarr <- example_loglik_array()
75
waic1 <- suppressWarnings(waic(LLarr))
86
loo1 <- suppressWarnings(loo(LLarr))

0 commit comments

Comments
 (0)