# Price close to winning bid (R024)

The percentage difference between the winning bid and the second-lowest valid bid is a low outlier.

:::{seealso}
{doc}`058`
:::

## Methodology

For each contracting process, the **difference** is calculated as $(secondLowestValidBidAmount - winningBidAmount) \over winningBidAmount$.

A contracting process is flagged if the difference is less than or equal to the **lower fence** of $Q_1 - 1.5(IQR)$, where $Q_1$ is the first quartile and $IQR$ is the interquartile range for the set of differences.

The winner and second-lowest bidder are also flagged.

:::{admonition} Example
:class: seealso

In 25% ($Q_1$) of contracting processes in Atlantis, the second-lowest valid bid is at most 5% greater than the winning bid. In 75% ($Q_3$) of contracting processes, it is at most 7% greater. This yields a lower fence of 2% (`0.02`).

In a contracting process, CollusionCorp won with a bid of \$100,000, and ProcureManipulate lost with the second-lowest bid of \$101,000. The difference is 1% (`0.01`). This is less than the lower fence of 2%. Therefore, the process is flagged.
:::

:::{admonition} Why is this a red flag?
:class: hint

A colluding bidder can mimic competition by submitting a bid that is similar in price (but different in quality, for example) from its colluding partner.
:::

<small>Based on "Difference between first and second relative offer prices" in [*Toolkit for detecting collusive bidding in public procurement*](https://www.govtransparency.eu/wp-content/uploads/2015/11/GTI_WP2014_2_Toth_et_al_150413.pdf) and "Winning tender just below the next lowest bid" in [*Fraud in Public Procurement: A collection of Red Flags and Best Practices*](https://ec.europa.eu/sfc/system/files/documents/sfc-files/fraud-public-procurement-final-20122017-ares20176254403.pdf).</small>

## Output

The indicator's value for the contracting process is the **difference**, as a decimal.

The indicator's value for the tenderer is always 0.0.

If the ``--map`` command-line flag is set, the ``Maps`` key contains:

ocid_tenderer_r024
: The flagged tenderers for each flagged `ocid`.

## Configuration

All configuration is optional. To override the default **lower fence**, add to your settings file, as a decimal:

```ini
[R024]
threshold = 0.05
```

:::{seealso}
`no_price_comparison_procurement_methods` and `price_comparison_procurement_methods` in {ref}`global-configuration`
:::

## Exclusions

A contracting process is excluded if:

- An award's status is pending or invalid.
- The winning bid is not the lowest bid. (This indicator requires the award criteria to be price-only.)
- There are multiple active awards (a.k.a. winning bids). [#14](https://github.com/open-contracting/cardinal-rs/issues/14)
- A bid is submitted by multiple tenderers. [#17](https://github.com/open-contracting/cardinal-rs/issues/17)
- An award is made to multiple suppliers. [#17](https://github.com/open-contracting/cardinal-rs/issues/17)

:::{note}
Do you want to eliminate an exclusion? Please contributed to the linked GitHub issue.
:::

## Assumptions

This indicator assumes that the tenderer of the winning bid didn't submit another valid bid.

## Demonstration

*Input*

:::{literalinclude} ../../../examples/R/024.jsonl
:language: json
:::

*Output*

```console
$ ocdscardinal indicators --settings docs/examples/R/024.ini --no-meta docs/examples/R/024.jsonl
{"OCID":{"F":{"R024":1.0}},"Tenderer":{"W":{"R024":0.0},"L":{"R024":0.0}}}

```
