@@ -87,7 +87,7 @@ ci_hcp <- function(cis, estimates, value, dist, est, rescale, nboot, hc) {
87
87
}
88
88
89
89
censoring <- censoring / rescale
90
-
90
+
91
91
ests <- boot_estimates(fun = fun , dist = dist , estimates = estimates ,
92
92
pars = pars , nboot = nboot , data = data , weighted = weighted ,
93
93
censoring = censoring , min_pmix = min_pmix ,
@@ -212,10 +212,26 @@ hcp_weighted <- function(hcp, weight, value, method, nboot) {
212
212
# wt = rep(1, length(value)),
213
213
method = method ,
214
214
nboot = nboot ,
215
- # pboot = min$pboot
215
+ # pboot = min$pboot
216
216
)
217
217
}
218
218
219
+ .ssd_hcp_ind <- function (x , value , ci , level , nboot , min_pboot , estimates ,
220
+ data , rescale ,
221
+ weighted , censoring , min_pmix , range_shape1 ,
222
+ range_shape2 , parametric , fix_weights ,
223
+ average , control , hc , save_to , samples , fun , method ) {
224
+ weight <- purrr :: map_dbl(estimates , function (x ) x $ weight )
225
+ hcp <- purrr :: map2(x , weight , .ssd_hcp_tmbfit ,
226
+ value = value , ci = ci , level = level , nboot = nboot ,
227
+ min_pboot = min_pboot ,
228
+ data = data , rescale = rescale , weighted = weighted , censoring = censoring ,
229
+ min_pmix = min_pmix , range_shape1 = range_shape1 , range_shape2 = range_shape2 ,
230
+ parametric = parametric , fix_weights = fix_weights , average = average , control = control ,
231
+ hc = hc , save_to = save_to , samples = samples , fun = fun )
232
+ hcp_ind(hcp , weight , method )
233
+ }
234
+
219
235
.ssd_hcp_fitdists <- function (
220
236
x ,
221
237
value ,
@@ -268,8 +284,18 @@ hcp_weighted <- function(hcp, weight, value, method, nboot) {
268
284
269
285
method <- if (parametric ) " parametric" else " non-parametric"
270
286
271
- # roll this block into own function and then call with ci = FALSE to get estimates if needed.
272
287
if (! average ) {
288
+ hcp_ind <- .ssd_hcp_ind(
289
+ x , value = value , ci = ci , level = level , nboot = nboot ,
290
+ min_pboot = min_pboot , estimates = estimates ,
291
+ data = data , rescale = rescale , weighted = weighted , censoring = censoring ,
292
+ min_pmix = min_pmix , range_shape1 = range_shape1 , range_shape2 = range_shape2 ,
293
+ parametric = parametric , fix_weights = fix_weights , average = average , control = control ,
294
+ hc = hc , save_to = save_to , samples = samples , fun = fun , method = method )
295
+ return (hcp_ind )
296
+ }
297
+
298
+ if (! multi ) {
273
299
weight <- purrr :: map_dbl(estimates , function (x ) x $ weight )
274
300
hcp <- purrr :: map2(x , weight , .ssd_hcp_tmbfit ,
275
301
value = value , ci = ci , level = level , nboot = nboot ,
@@ -278,18 +304,6 @@ hcp_weighted <- function(hcp, weight, value, method, nboot) {
278
304
min_pmix = min_pmix , range_shape1 = range_shape1 , range_shape2 = range_shape2 ,
279
305
parametric = parametric , fix_weights = fix_weights , average = average , control = control ,
280
306
hc = hc , save_to = save_to , samples = samples , fun = fun )
281
- return (hcp_ind(hcp , weight , method ))
282
- }
283
-
284
- if (! multi ) {
285
- weight <- purrr :: map_dbl(estimates , function (x ) x $ weight )
286
- hcp <- purrr :: map2(x , weight , .ssd_hcp_tmbfit ,
287
- value = value , ci = ci , level = level , nboot = nboot ,
288
- min_pboot = min_pboot ,
289
- data = data , rescale = rescale , weighted = weighted , censoring = censoring ,
290
- min_pmix = min_pmix , range_shape1 = range_shape1 , range_shape2 = range_shape2 ,
291
- parametric = parametric , fix_weights = fix_weights , average = average , control = control ,
292
- hc = hc , save_to = save_to , samples = samples , fun = fun )
293
307
294
308
# TODO: implement hcp_weighted
295
309
# TODO: perhaps rename average to unweighted
0 commit comments