calc_riskRatio_binom: Compute risk ratio and uncertainty based on binomial models...

Description Usage Arguments Details Author(s) References Examples

View source: R/risk_ratio.R

Description

Compute risk ratio and uncertainty by fitting binomial models to counts of events relative to possible number of events. The risk ratio is the ratio of the probability of an event under the model fit to the first dataset to the probability under the model fit to the second dataset. Default standard errors are based on the usual MLE asymptotics using a delta-method-based approximation, but standard errors based on the nonparametric bootstrap and on a likelihood ratio procedure can also be computed.

Usage

1
2
3
calc_riskRatio_binom(y, n, ciLevel = 0.9, bootCI = FALSE,
  bootControl = list(seed = 1, n = 500), lrtCI = FALSE,
  lrtControl = list(bounds = c(0.01, 100)))

Arguments

y

vector of two values, the number of events in the two scenarios

n

vector of two values, the number of samples (possible occurrences of events) in the two scenarios

ciLevel

statistical confidence level for confidence intervals; in repeated experimentation, this proportion of confidence intervals should contain the true risk ratio. Note that if only one endpoint of the resulting interval is used, for example the lower bound, then the effective confidence level increases by half of one minus ciLevel. For example, a two-sided 0.90 confidence interval corresponds to a one-sided 0.95 confidence interval.

bootCI

logical indicating whether to use the bootstrap to estimate a confidence interval (and standard error).

bootControl

a list of control parameters for the bootstrapping. See Details.

lrtCI

logical indicating whether to calculate a likelihood ratio-based confidence interval.

lrtControl

list containing a single component, bounds, which sets the range inside which the algorithm searches for the endpoints of the likelihood ratio-based confidence interval. This avoids numerical issues with endpoints converging to zero and infinity. If an endpoint is not found within the interval, it is set to NA.

Details

See fit_pot for information on the bootControl argument.

Author(s)

Christopher J. Paciorek

References

Paciorek et al. methods paper being finalized.

Examples

1
2
3
4
5
6
# risk ratio for 40/400 compared to 8/400 events and for
# 4/100 compared to 0/100 events
calc_riskRatio_binom(c(40, 8), c(400, 400), bootCI = TRUE, lrtCI = TRUE)
# LRT method can estimate lower confidence interval endpoint,
# even if estimated risk ratio is infinity:
calc_riskRatio_binom(c(4,0), c(100, 100), bootCI = FALSE, lrtCI = TRUE)

climextRemes documentation built on May 29, 2017, 9:58 p.m.

Search within the climextRemes package
Search all R packages, documentation and source code