# prevalence_bounds: Prevalence bounds and confidence interval In ARPobservation: Tools for Simulating Direct Behavioral Observation Recording Procedures Based on Alternating Renewal Processes

## Description

Calculates a bound for the log of the prevalence 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

 ``` 1 2 3 4 5 6 7 8 9 10``` ```prevalence_bounds( PIR, phase, base_level, mu_L, 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_L` the lower limit on the mean event duration `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 prevalence ratio estimate is based on the assumptions that 1) the underlying behavior stream follows an Alternating Renewal Process and 2) the average event duration is greater than `mu_L`.

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_L` is the lower 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 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 error of the estimate. The third entry, `estimate_CI`, contains the lower and upper bounds for the confidence interval of the prevalence ratio.

## Author(s)

Daniel Swan <dswan@utexas.edu>

## Examples

 ```1 2 3 4 5``` ```# Estimate bounds on the prevalence ratio for Carl from Moes dataset data(Moes) with(subset(Moes, Case == "Carl"), prevalence_bounds(PIR = outcome, phase = Phase, base_level = "No Choice", mu_L = 10, active_length = active_length, intervals = intervals)) ```

ARPobservation documentation built on May 1, 2021, 1:08 a.m.