@@ -4,6 +4,7 @@ context("PPC: predictive errors")
4
4
source(test_path(" data-for-ppc-tests.R" ))
5
5
6
6
test_that(" ppc_error_hist and ppc_error_scatter return ggplot object" , {
7
+ skip_if_not_installed(" rstantools" )
7
8
expect_gg(ppc_error_hist(y , yrep [1 : 5 , ], binwidth = 0.1 ))
8
9
expect_gg(ppc_error_scatter(y , yrep [1 : 5 , ]))
9
10
@@ -15,17 +16,20 @@ test_that("ppc_error_hist and ppc_error_scatter return ggplot object", {
15
16
})
16
17
17
18
test_that(" ppc_error_hist_grouped returns ggplot object" , {
19
+ skip_if_not_installed(" rstantools" )
18
20
expect_gg(ppc_error_hist_grouped(y , yrep [1 : 5 , ], group , binwidth = 0.1 ))
19
21
expect_gg(ppc_error_hist_grouped(y , yrep [1 ,, drop = FALSE ], group ,
20
22
freq = FALSE , binwidth = 1 ))
21
23
})
22
24
23
25
test_that(" ppc_error_scatter_avg returns ggplot2 object" , {
26
+ skip_if_not_installed(" rstantools" )
24
27
expect_gg(ppc_error_scatter_avg(y , yrep ))
25
28
expect_gg(ppc_error_scatter_avg(y , yrep [1 : 5 , ]))
26
29
})
27
30
28
31
test_that(" ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1" , {
32
+ skip_if_not_installed(" rstantools" )
29
33
p1 <- ppc_error_scatter_avg(y2 , yrep2 )
30
34
p2 <- ppc_error_scatter(y2 , yrep2 )
31
35
d1 <- p1 $ data
@@ -37,11 +41,13 @@ test_that("ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1", {
37
41
})
38
42
39
43
test_that(" ppc_error_scatter_avg_vs_x returns ggplot2 object" , {
44
+ skip_if_not_installed(" rstantools" )
40
45
expect_gg(ppc_error_scatter_avg_vs_x(y , yrep , x = rnorm(length(y ))))
41
46
expect_gg(ppc_error_scatter_avg_vs_x(y , yrep [1 : 5 , ], x = rnorm(length(y ))))
42
47
})
43
48
44
49
test_that(" ppc_error_binned returns ggplot object" , {
50
+ skip_if_not_installed(" rstantools" )
45
51
load(test_path(" data-for-binomial.rda" ))
46
52
expect_gg(ppc_error_binned(y , Ey ))
47
53
expect_gg(ppc_error_binned(y [1 : 5 ], Ey [, 1 : 5 ]))
0 commit comments