@@ -54,13 +54,8 @@ test_that("blr_segment prints the correct output", {
5454test_that(" output from blr_twoway_segment is as expected" , {
5555
5656 k <- blr_segment_twoway(hsb2 , honcomp , prog , race )
57- actual <-
58- k %> %
59- use_series(twoway_segment ) %> %
60- `[`(, 4 ) %> %
61- round(2 ) %> %
62- unname()
63- expected <- c(0.04 , 0.16 , 0.02 )
57+ actual <- unname(round(k $ twoway_segment [, 4 ], 3 ))
58+ expected <- c(0.035 , 0.165 , 0.020 )
6459 expect_equivalent(actual , expected )
6560})
6661
@@ -155,78 +150,78 @@ test_that("output from blr_woe_iv_stats is as expected", {
155150
156151 x <- cat(" Variable: prog
157152
158- Weight of Evidence
153+ Weight of Evidence
159154-------------------------------------------------------------------------
160- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
155+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
161156-------------------------------------------------------------------------
162- 1 38 7 0.26 0.13 0.67 0.08
163- 2 65 40 0.44 0.75 -0.53 0.17
164- 3 44 6 0.30 0.11 0.97 0.18
157+ 1 38 7 0.26 0.13 0.67 0.08
158+ 2 65 40 0.44 0.75 -0.53 0.17
159+ 3 44 6 0.30 0.11 0.97 0.18
165160-------------------------------------------------------------------------
166161
167- Information Value
162+ Information Value
168163-----------------------------
169- Variable Information Value
164+ Variable Information Value
170165-----------------------------
171- prog 0.4329
166+ prog 0.4329
172167-----------------------------
173168
174169
175170Variable: race
176171
177- Weight of Evidence
172+ Weight of Evidence
178173-------------------------------------------------------------------------
179- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
174+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
180175-------------------------------------------------------------------------
181- 1 22 2 0.15 0.04 1.38 0.15
182- 2 6 5 0.04 0.09 -0.84 0.04
183- 3 18 2 0.12 0.04 1.18 0.10
184- 4 101 44 0.69 0.83 -0.19 0.03
176+ 1 22 2 0.15 0.04 1.38 0.15
177+ 2 6 5 0.04 0.09 -0.84 0.04
178+ 3 18 2 0.12 0.04 1.18 0.10
179+ 4 101 44 0.69 0.83 -0.19 0.03
185180-------------------------------------------------------------------------
186181
187- Information Value
182+ Information Value
188183-----------------------------
189- Variable Information Value
184+ Variable Information Value
190185-----------------------------
191- race 0.326
186+ race 0.326
192187-----------------------------
193188
194189
195190Variable: female
196191
197- Weight of Evidence
192+ Weight of Evidence
198193-------------------------------------------------------------------------
199- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
194+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
200195-------------------------------------------------------------------------
201- 0 73 18 0.50 0.34 0.38 0.06
202- 1 74 35 0.50 0.66 -0.27 0.04
196+ 0 73 18 0.50 0.34 0.38 0.06
197+ 1 74 35 0.50 0.66 -0.27 0.04
203198-------------------------------------------------------------------------
204199
205- Information Value
200+ Information Value
206201-----------------------------
207- Variable Information Value
202+ Variable Information Value
208203-----------------------------
209- female 0.1023
204+ female 0.1023
210205-----------------------------
211206
212207
213208Variable: schtyp
214209
215- Weight of Evidence
210+ Weight of Evidence
216211------------------------------------------------------------------------
217- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
212+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
218213------------------------------------------------------------------------
219- 1 123 45 0.84 0.85 -0.01 0.00
220- 2 24 8 0.16 0.15 0.08 0.00
214+ 1 123 45 0.84 0.85 -0.01 0.00
215+ 2 24 8 0.16 0.15 0.08 0.00
221216------------------------------------------------------------------------
222217
223- Information Value
218+ Information Value
224219-----------------------------
225- Variable Information Value
220+ Variable Information Value
226221-----------------------------
227- schtyp 0.0012
222+ schtyp 0.0012
228223-----------------------------" )
229224
230225 expect_output(print(k ), x )
231226
232- })
227+ })
0 commit comments