@@ -44,15 +44,24 @@ test_that("check_ess works with binary groups", {
4444})
4545
4646test_that(" check_ess works with categorical groups" , {
47- result <- check_ess(nhefs_weights , .weights = w_cat_ate , .group = alcoholfreq_cat )
47+ result <- check_ess(
48+ nhefs_weights ,
49+ .weights = w_cat_ate ,
50+ .group = alcoholfreq_cat
51+ )
4852
4953 expect_s3_class(result , " tbl_df" )
5054 expect_true(" group" %in% names(result ))
5155 expect_true(length(unique(result $ group )) > 2 )
5256})
5357
5458test_that(" check_ess works with continuous groups" , {
55- result <- check_ess(nhefs_weights , .weights = w_ate , .group = age , n_tiles = 4 )
59+ result <- check_ess(
60+ nhefs_weights ,
61+ .weights = w_ate ,
62+ .group = age ,
63+ n_tiles = 4
64+ )
5665
5766 expect_s3_class(result , " tbl_df" )
5867 expect_true(" group" %in% names(result ))
@@ -123,7 +132,11 @@ test_that("ESS calculation is correct", {
123132 wts2 = c(4 , 0 , 0 , 0 ) # All weight on one obs -> ESS = 1
124133 )
125134
126- result <- check_ess(test_df , .weights = c(wts , wts2 ), include_observed = FALSE )
135+ result <- check_ess(
136+ test_df ,
137+ .weights = c(wts , wts2 ),
138+ include_observed = FALSE
139+ )
127140
128141 expect_equal(result $ ess [result $ method == " wts" ], 4 )
129142 expect_equal(result $ ess [result $ method == " wts2" ], 1 )
0 commit comments