tbr_binom {tbrf} | R Documentation |
Time-Based Rolling Binomial Probability
Description
Produces a a rolling time-window based vector of binomial probability and confidence intervals.
Usage
tbr_binom(.tbl, x, tcolumn, unit = "years", n, alpha = 0.05)
Arguments
.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 |
Value
tibble with binomial point estimate and confidence intervals.
See Also
Examples
## 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)
[Package tbrf version 0.1.5 Index]