interim_bounds {ARPobservation}R Documentation

Interim bounds and confidence interval


Calculates a bound for the log of the ratio of interim time of two samples (referred to as baseline and treatment) based on partial interval recording (PIR) data, assuming that the average event durations are equal across samples and that interim times are exponentially distributed.


  conf_level = 0.95,
  intervals = NA,
  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.


Desired coverage rate of the calculated confidence interval. Default is .95.


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


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


The interim ratio estimate is based on the assumptions that 1) the underlying behavior stream follows an Alternating Renewal Process, 2) the average event durations in each sample are equal, and 3) interim times follow exponential distributions.

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.

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. If intervals is sent as a vector instead of a single value, the first value in the vector will be used. 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 with three named entries The first entry, estimate_bounds, contains the lower and upper bound for the estimate of the prevalence ratio. The second entry, estimate_SE, contains the standard errors for the upper and lower bounds. The third entry, estimate_CI, contains the lower and upper bounds for the confidence interval of the prevalence ratio.


Daniel Swan <>


# Estimate bounds on the interim time ratio for Carl from the Moes dataset
with(subset(Moes, Case == "Carl"),
interim_bounds(PIR = outcome, phase = Phase, base_level = "No Choice"))

[Package ARPobservation version 1.2.2 Index]