@@ -53,6 +53,31 @@ test_that("duplicated rhats and neffs are kept (#105)", {
53
53
expect_equal(nrow(df ), length(ratios ))
54
54
})
55
55
56
+ test_that(" 'description' & 'rating' columns are correct (#176)" , {
57
+ # https://github.com/stan-dev/bayesplot/issues/176
58
+ rhats <- c(1 , 1.07 , 1.19 , 1.07 , 1.3 , 1 )
59
+ expected_rhats <- sort(rhats )
60
+ expected_ratings <- rep(c(" low" , " ok" , " high" ), each = 2 )
61
+ expected_descriptions <-
62
+ rep(c(" hat(R) <= 1.05" , " hat(R) <= 1.1" , " hat(R) > 1.1" ), each = 2 )
63
+
64
+ df <- mcmc_rhat_data(rhats )
65
+ expect_equal(df $ value , expected_rhats )
66
+ expect_equal(as.character(df $ rating ), expected_ratings )
67
+ expect_equal(df $ description , expected_descriptions )
68
+
69
+ ratios <- c(0.4 , 0.05 , 0.6 )
70
+ expected_ratios <- sort(ratios )
71
+ expected_ratings <- c(" low" , " ok" , " high" )
72
+ expected_descriptions <-
73
+ c(" N[eff]/N <= 0.1" , " N[eff]/N <= 0.5" , " N[eff]/N > 0.5" )
74
+
75
+ df <- mcmc_neff_data(ratios )
76
+ expect_equal(df $ value , expected_ratios )
77
+ expect_equal(as.character(df $ rating ), expected_ratings )
78
+ expect_equal(df $ description , expected_descriptions )
79
+ })
80
+
56
81
test_that(" mcmc_acf & mcmc_acf_bar return a ggplot object" , {
57
82
expect_gg(mcmc_acf(arr , pars = " beta[1]" , regex_pars = " x\\ :[2,5]" ))
58
83
expect_gg(mcmc_acf_bar(arr , pars = " beta[1]" , regex_pars = " x\\ :[2,5]" ))
0 commit comments