incidence_bounds {ARPobservation}R Documentation

Incidence bounds and confidence interval


Calculates a bound for the log of the incidence ratio of two samples (referred to as baseline and treatment) based on partial interval recording (PIR) data, assuming that the behavior follows an Alternating Renewal Process.


  intervals = NA,
  conf_level = 0.95,
  exponentiate = FALSE



vector of PIR measurements


factor or vector indicating levels of the PIR measurements.


a character string or value indicating the name of the baseline level.


the upper limit on the mean event duration


upper limit on the probability that the interim time between behavioral events is less than the active interval


length of the active observation interval


the number of intervals in the sample of observations. Default is NA


Coverage rate of the confidence interval. Default is .95.


Logical value indicating if the log of the bounds and the confidence interval should be exponentiated. Default is FALSE.


The incidence ratio estimate is based on the assumptions that 1) the underlying behavior stream follows an Alternating Renewal Process, 2) the average event duration is less than mu_U, and 3) the probability of observing an interim time less than the active interval length is less than p.

The PIR vector can be in any order corresponding to the factor or vector phase. The levels of phase can be any two levels, such as "A" and "B", "base" and "treat", or "0" and "1". If there are more than two levels in phase this function will not work. A value for base_level must be specified - if it is a character string it is case sensitive.

For all of the following variables, the function assumes that if a vector of values is provided they are constant across all observations and simply uses the first value in that vector.

mu_U is the upper limit on the mean event durations. This is a single value assumed to hold for both samples of behavior

active_length This is the total active observation length. If the intervals are 15 seconds long but 5 seconds of each interval is reserved for recording purposes, active_length= 10. Times are often in seconds, but can be in any time unit.

intervals is the number of intervals in the observations. This is a single value and is assumed to be constant across both samples and all observations. This value is only relevant if the mean of one of the samples is at the floor or ceiling of 0 or 1. In that case it will be used to truncate the sample mean. If the sample mean is at the floor or ceiling and no value for intervals is provided, the function will stop.


A list containing two named vectors and a single named number. The first entry, estimate_bounds, contains the lower and upper bound for the estimate of the incidence ratio. The second entry, estimate_SE, contains the standard error of the estimate. The third entry, estimate_CI, contains the lower and upper bounds for the confidence interval of the incidence ratio.


Daniel Swan <>


# Estimate bounds on the incidence ratio for Ahmad from the Dunlap dataset
with(subset(Dunlap, Case == "Ahmad"),
incidence_bounds(PIR = outcome, phase = Phase, base_level = "No Choice",
                 mu_U = 10, p = .15, active_length = active_length, intervals = intervals))

[Package ARPobservation version 1.2.2 Index]