Skip to content

Commit

Permalink
correct failure counting. partially addresses #44
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lawrence Miller committed Jun 14, 2021
1 parent 45e3747 commit 4b128ab
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions R/bootdht.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ bootdht <- function(model,
# fit the model nboot times over cores cores
# note there is a bit of fiddling here with the progress bar to get it to
# work (updates happen in this loop rather than in bootit)
boot_ests <- foreach::foreach(i=1:nboot, .combine=rbind.data.frame,
boot_ests <- foreach::foreach(i=1:nboot,
.multicombine=TRUE) %dopar2% {
r <- bootit(dat, models=models, our_resamples=our_resamples,
summary_fun=summary_fun, convert.units=convert.units,
Expand All @@ -276,15 +276,20 @@ bootdht <- function(model,
r
}
pb$done(pb$pb)
# post-process
nbootfail <- sum(unlist(lapply(boot_ests, is.na)))
boot_ests <- Filter(function(x) !is.na(x), boot_ests)
}else{
boot_ests <- replicate(nboot,
bootit(dat, models=models, our_resamples,
summary_fun, convert.units=convert.units,
pb=pb), simplify=FALSE)
# the above is then a list of thingos, do the "right" thing and assume
# they are data.frames and then rbind them all together
boot_ests <- do.call(rbind.data.frame, boot_ests)
}
# the above is then a list of thingos, do the "right" thing and assume
# they are data.frames and then rbind them all together
boot_ests <- do.call(rbind.data.frame, boot_ests)


cat("\n")

attr(boot_ests, "nboot") <- nboot
Expand Down

0 comments on commit 4b128ab

Please sign in to comment.