@@ -4,6 +4,7 @@ context("PPC: predictive errors")
44source(test_path(" data-for-ppc-tests.R" ))
55
66test_that(" ppc_error_hist and ppc_error_scatter return ggplot object" , {
7+ skip_if_not_installed(" rstantools" )
78 expect_gg(ppc_error_hist(y , yrep [1 : 5 , ], binwidth = 0.1 ))
89 expect_gg(ppc_error_scatter(y , yrep [1 : 5 , ]))
910
@@ -15,17 +16,20 @@ test_that("ppc_error_hist and ppc_error_scatter return ggplot object", {
1516})
1617
1718test_that(" ppc_error_hist_grouped returns ggplot object" , {
19+ skip_if_not_installed(" rstantools" )
1820 expect_gg(ppc_error_hist_grouped(y , yrep [1 : 5 , ], group , binwidth = 0.1 ))
1921 expect_gg(ppc_error_hist_grouped(y , yrep [1 ,, drop = FALSE ], group ,
2022 freq = FALSE , binwidth = 1 ))
2123})
2224
2325test_that(" ppc_error_scatter_avg returns ggplot2 object" , {
26+ skip_if_not_installed(" rstantools" )
2427 expect_gg(ppc_error_scatter_avg(y , yrep ))
2528 expect_gg(ppc_error_scatter_avg(y , yrep [1 : 5 , ]))
2629})
2730
2831test_that(" ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1" , {
32+ skip_if_not_installed(" rstantools" )
2933 p1 <- ppc_error_scatter_avg(y2 , yrep2 )
3034 p2 <- ppc_error_scatter(y2 , yrep2 )
3135 d1 <- p1 $ data
@@ -37,11 +41,13 @@ test_that("ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1", {
3741})
3842
3943test_that(" ppc_error_scatter_avg_vs_x returns ggplot2 object" , {
44+ skip_if_not_installed(" rstantools" )
4045 expect_gg(ppc_error_scatter_avg_vs_x(y , yrep , x = rnorm(length(y ))))
4146 expect_gg(ppc_error_scatter_avg_vs_x(y , yrep [1 : 5 , ], x = rnorm(length(y ))))
4247})
4348
4449test_that(" ppc_error_binned returns ggplot object" , {
50+ skip_if_not_installed(" rstantools" )
4551 load(test_path(" data-for-binomial.rda" ))
4652 expect_gg(ppc_error_binned(y , Ey ))
4753 expect_gg(ppc_error_binned(y [1 : 5 ], Ey [, 1 : 5 ]))
0 commit comments