incidence_bounds {ARPobservation}R Documentation

Incidence bounds and confidence interval

Description

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.

Usage

incidence_bounds(
  PIR,
  phase,
  base_level,
  mu_U,
  p,
  active_length,
  intervals = NA,
  conf_level = 0.95,
  exponentiate = FALSE
)

Arguments

PIR

vector of PIR measurements

phase

factor or vector indicating levels of the PIR measurements.

base_level

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

mu_U

the upper limit on the mean event duration

p

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

active_length

length of the active observation interval

intervals

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

conf_level

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

exponentiate

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

Details

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.

Value

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.

Author(s)

Daniel Swan <dswan@utexas.edu>

Examples


# Estimate bounds on the incidence ratio for Ahmad from the Dunlap dataset
data(Dunlap)
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]