tbr_binom | R Documentation |
Produces a a rolling time-window based vector of binomial probability and confidence intervals.
tbr_binom(.tbl, x, tcolumn, unit = "years", n, alpha = 0.05)
.tbl |
dataframe with two variables. |
x |
indicates the variable column containing "success" and "failure" observations coded as 1 or 0. |
tcolumn |
indicates the variable column containing Date or Date-Time values. |
unit |
character, one of "years", "months", "weeks", "days", "hours", "minutes", "seconds" |
n |
numeric, describing the length of the time window in the selected units. |
alpha |
numeric, probability of a type 1 error, so confidence coefficient = 1-alpha |
tibble with binomial point estimate and confidence intervals.
binom_ci
## Generate Sample Data
df <- tibble::tibble(
date = sample(seq(as.Date('2000-01-01'), as.Date('2015/12/30'), by = "day"), 100),
value = rbinom(100, 1, 0.25)
)
## Run Function
tbr_binom(df, x = value,
tcolumn = date, unit = "years", n = 5,
alpha = 0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.