compute_cumcount_ci is a function that computes confidence intervals for cumulative count estimates using the influence curve or supplied bootstrap replicates to estimate standard errors.

compute_cumcount_ci(
  obj,
  alpha = 0.05,
  ic = FALSE,
  count_time = NULL,
  boot_method = "log-normal"
)

Arguments

obj

A cumcount object containing the count estimates, e.g., as computed by estimate_ipwcount

alpha

The desired nominal significance level of the confidence intervals.

ic

If the supplied object contains a bootstrap count estimates, setting ic = TRUE will requests that estimated standard errors be derived from the influence curve.

count_time

The time at which the cumulative count estimates should be returned (the default value NULL returns all times)

boot_method

The specific bootstrap approach used to compute confidence intervals. Options are "log-normal" (default; normal approximation on the log scale), "normal" (normal approximation on the count scale), "percentile" (percentile-based approach using quantiles of the bootstrap distribution), and "basic" (basic bootstrap using the reflection method). When obj was created without using bootstrap estimation or ic = TRUE is provided then the value of boot_method is ignored.

Value

A data frame containing the cumulative count, its variance, and the confidence interval for each time point and treatment group, with the rows ordered by treatment group and then time. When treatment groups were provided then the groups follow the level order of the treatment: its factor levels, or its sorted unique values when it was not supplied as a factor. The bounds are truncated to [0, Inf), the support of a count. With bootstrap replicates, the variance is on the log scale for "log-normal" and on the count scale otherwise, non-finite replicates (and, for "log-normal", replicates equal to 0) are excluded, and the estimate, variance, and bounds are missing when fewer than two replicates are usable; see the Handling non-finite values

section of compute_cumcount_effect_ci for the reasoning.

Author

M. Alan Brookhart & Alexander Breskin