@@ -54,13 +54,8 @@ test_that("blr_segment prints the correct output", {
54
54
test_that(" output from blr_twoway_segment is as expected" , {
55
55
56
56
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 )
64
59
expect_equivalent(actual , expected )
65
60
})
66
61
@@ -155,78 +150,78 @@ test_that("output from blr_woe_iv_stats is as expected", {
155
150
156
151
x <- cat(" Variable: prog
157
152
158
- Weight of Evidence
153
+ Weight of Evidence
159
154
-------------------------------------------------------------------------
160
- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
155
+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
161
156
-------------------------------------------------------------------------
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
165
160
-------------------------------------------------------------------------
166
161
167
- Information Value
162
+ Information Value
168
163
-----------------------------
169
- Variable Information Value
164
+ Variable Information Value
170
165
-----------------------------
171
- prog 0.4329
166
+ prog 0.4329
172
167
-----------------------------
173
168
174
169
175
170
Variable: race
176
171
177
- Weight of Evidence
172
+ Weight of Evidence
178
173
-------------------------------------------------------------------------
179
- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
174
+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
180
175
-------------------------------------------------------------------------
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
185
180
-------------------------------------------------------------------------
186
181
187
- Information Value
182
+ Information Value
188
183
-----------------------------
189
- Variable Information Value
184
+ Variable Information Value
190
185
-----------------------------
191
- race 0.326
186
+ race 0.326
192
187
-----------------------------
193
188
194
189
195
190
Variable: female
196
191
197
- Weight of Evidence
192
+ Weight of Evidence
198
193
-------------------------------------------------------------------------
199
- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
194
+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
200
195
-------------------------------------------------------------------------
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
203
198
-------------------------------------------------------------------------
204
199
205
- Information Value
200
+ Information Value
206
201
-----------------------------
207
- Variable Information Value
202
+ Variable Information Value
208
203
-----------------------------
209
- female 0.1023
204
+ female 0.1023
210
205
-----------------------------
211
206
212
207
213
208
Variable: schtyp
214
209
215
- Weight of Evidence
210
+ Weight of Evidence
216
211
------------------------------------------------------------------------
217
- levels 0s_count 1s_count 0s_dist 1s_dist woe iv
212
+ levels 0s_count 1s_count 0s_dist 1s_dist woe iv
218
213
------------------------------------------------------------------------
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
221
216
------------------------------------------------------------------------
222
217
223
- Information Value
218
+ Information Value
224
219
-----------------------------
225
- Variable Information Value
220
+ Variable Information Value
226
221
-----------------------------
227
- schtyp 0.0012
222
+ schtyp 0.0012
228
223
-----------------------------" )
229
224
230
225
expect_output(print(k ), x )
231
226
232
- })
227
+ })
0 commit comments