PIR_MOM {ARPobservation} | R Documentation |

Estimates prevalence and incidence for two samples, along with the ratios of each parameter, assuming that the behavior follows an '. Also provides bootstrap confidence intervals.

```
PIR_MOM(
PIR,
phase,
base_level,
intervals,
interval_length,
rest_length = 0,
Bootstraps = 2000,
conf_level = 0.95,
exponentiate = FALSE,
seed = NULL
)
```

`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. |

`intervals` |
the number of intervals in the sample of observations |

`interval_length` |
the total length of each interval |

`rest_length` |
length of the portion of the interval devoted to recording. Default is |

`Bootstraps` |
desired number of bootstrap replicates. Default is |

`conf_level` |
Desired coverage rate of the calculated confidence interval. Default is |

`exponentiate` |
a logical indicating whether the row corresponding to the ratio of treatment to baseline should be exponentiated, with the default as |

`seed` |
seed value set in order to make bootstrap results reproducible. Default is |

The moment estimators are based on the assumption that the underlying behavior stream follows an Alternating Poisson Process, in which both the event durations and interim times are exponentially distributed.

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`

, `interval_length`

, and `rest_length`

are all single values that
are assumed to be held constant across both samples and all observation sessions.
If vectors of values are provided for these variables, it is assumed that the first value
in each vector is constant across all observations.

`interval_length`

This is the total length of each individual interval.
Sometimes a portion of the interval is set aside for recording purposes, in which case
`rest_length`

should be set to the length of time devoted to recording.
The default assumption is that there is no recording time.
The length of time devoted to active observation is calculated as `interval_length - rest_length`

.

At the default setting of `bootstraps = 2000`

, PIR_MOM takes just under six seconds to run on an Intel Core i5-2410M processor.

A dataframe with six columns and three rows corresponding to baseline, treatment,
and the log ratio or ratio (depending upon the value of `exponentiate`

) of treatment to baseline

Daniel Swan <dswan@utexas.edu>

```
# Estimate prevalence and incidence ratios for Carl from the Moes dataset
data(Moes)
with(subset(Moes, Case == "Carl"),
PIR_MOM(PIR = outcome,
phase = Phase,
intervals = intervals,
interval_length = (active_length + rest_length),
rest_length = rest_length,
base_level = "No Choice",
Bootstraps = 200,
seed = 149568373))
```

[Package *ARPobservation* version 1.2.2 Index]