Detectable Event Rate for Safety Signal Detection: Using power_single_rate

# Detectable Event Rate for Safety Signal Detection: Using `power_single_rate`

## Introduction

One important question in drug safety monitoring or rare event studies is:

> “Given a specific sample size and the desired statistical power, what is the smallest event rate (proportion) that can be reliably detected (i.e., at least one event expected with a set probability)?”

The function `power_single_rate()` addresses this by calculating the minimum true underlying proportion of an event needed, so that, with a specified sample size, there is a specified power to observe at least one event.

This is typically used in clinical trial planning or post-marketing safety surveillance, where the event (such as a serious adverse reaction) is rare, but assuring a high probability to observe at least one event if the true rate is sufficiently high is crucial for safety oversight.

## Function

The function signature is:

    power_single_rate(subjects, power)

- `subjects`: Integer or vector. Sample size(s).
- `power`: Numeric or vector. Desired power(s), between 0 and 1.

The function returns a matrix (class `power_single_rate`) with columns: - `n`: sample size, - `power`: statistical power, - `proportion`: minimum detectable event rate.

A formatted print and summary are provided for nice displays.

## Examples

### Example 1: 100 Subjects, Power 0.95

Suppose you want to know the lowest event rate that would provide a 95% chance of observing at least one event among 100 subjects.

    library(ssutil)
    power_single_rate(100, 0.95)

    ## A study with 100 participants would have 95% power to detect at least one event
    ## if the true event rate is at least 2.95 per 100 participants.

### Example 2: 30 Subjects, Power 0.95, 0.90, and 0.8

Suppose your sample size is 30, and you want to know what true event rate you can potentially detect (at least one event) with powers of 80%, 90%, and 95%.

    power_single_rate(30, c(0.95, 0.90, 0.8))

    ## According to the number of participants, the table shows the power
    ## to detect at least one event, given a true event rate equal to or higher than:
    ##
    ## | Subjects | Power |                Proportion |
    ## | -------- | ----- | ------------------------- |
    ## |       30 |   95% | 9.50 per 100 participants |
    ## |       30 |   90% | 7.39 per 100 participants |
    ## |       30 |   80% | 5.22 per 100 participants |