Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bootstrap CI method #189

Open
ddsjoberg opened this issue Jul 25, 2024 · 0 comments · May be fixed by #205
Open

Add a bootstrap CI method #189

ddsjoberg opened this issue Jul 25, 2024 · 0 comments · May be fixed by #205
Assignees
Milestone

Comments

@ddsjoberg
Copy link
Collaborator

ddsjoberg commented Jul 25, 2024

Below is an example, but we will need to rename the function to align with the other CI functions. We will also need to generalize this a bit to account for different boot.ci(type) arguments and perhaps even boot(stype) arguments.

The other CI functions also include N in the results, so we should do the same with this one.

Also account for the special case with N = 1, when boot::boot.ci() doesn't error but doesn't return results: we want to the same structure of the returned named list each time.

boot_mean_ci <- function(x, conf.level = 0.95, R = 2000) {
  result <- list(estimate = NULL, conf.low = NULL, conf.high = NULL, conf.level = conf.level, R = R)
  boot <- boot::boot(data = x, statistic = \(x, i) mean(x[i], na.rm = TRUE), R = R, stype = "i")
  boot.ci <- boot::boot.ci(boot, conf = conf.level, type = "perc")
  result$estimate <- boot$t0
  result$conf.low <- boot.ci$percent[1, 4] |> unname()
  result$conf.high <- boot.ci$percent[1, 5] |> unname()

  result
}

cards::ard_continuous(ADSL, variables = AGE, statistic = everything() ~ boot_mean_ci)

I am torn on whether we should add this as an option to ard_continuous_ci(), because we would need to expose the type and stype arguments, if we do this then where would we stop? For now, let's not add...any other thoughts?

@ddsjoberg ddsjoberg added this to the v0.3.0 milestone Jul 25, 2024
@edelarua edelarua self-assigned this Aug 27, 2024
@edelarua edelarua linked a pull request Aug 28, 2024 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants