logRespRatio {ARPobservation} | R Documentation |

## Calculate log-response ratio, variance, and confidence interval

### Description

Estimates the log-response ratio (with or without bias correction), the variance of the log-response ratio, and the confidence interval for a given confidence level.

### Usage

```
logRespRatio(
observations,
phase,
base_level,
conf_level = 0.95,
bias_correct = TRUE,
exponentiate = FALSE
)
```

### Arguments

`observations` |
Vector of observations |

`phase` |
Factor or vector indicating levels of the PIR measurements. |

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

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

`bias_correct` |
Logical value indicating if the bias-corrected log-response ratio should be used. Default is |

`exponentiate` |
Logical value indicating if the log-response ratio should be exponentiated. |

### Details

The `observations`

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.
If `exponentiate = TRUE`

, the log-ratio and the confidence interval will be exponentiated,
but the variance will be excluded from the output.

### Value

If `exponentiate = FALSE`

, a list with three named entries.
The first entry, `lRR`

, is the estimated log-response ratio.
The second entry, `V_lRR`

, is the estimated variance of the log-response ratio.
The third entry, `CI`

, is a vector containing the endpoints of a confidence
interval of `conf_level`

coverage rate.

If `exponentiate = TRUE`

, a list with two named entries.
The first entry, `RR`

, is the estimated response ratio.
The second entry, `CI`

, is a vector containing the endpoints of a confidence
interval of `conf_level`

coverage rate.

### Author(s)

Daniel Swan <dswan@utexas.edu>

### Examples

```
# Estimate the log response ratio and its variance for Carl from Moes dataset
data(Moes)
with(subset(Moes, Case == "Carl"),
logRespRatio(observations = outcome, phase = Phase, base_level = "No Choice"))
```

*ARPobservation*version 1.2.2 Index]