# 1.2 Rate Mapping

## 1. Excess Risk

A commonly used notion in demography and public health analysis is the concept of a *standardized mortality rate* (SMR), sometimes also referred to as *relative risk* or *excess risk*. The idea is to compare the observed mortality rate to a national (or regional) standard. More specifically, the observed number of events is compared to the number of events that would be expected had a reference risk been applied.

In most applications, the reference risk is estimated from the aggregate of all the observations under consideration. For example, if we considered all the counties in Ohio, the reference rate would be the sum of all the events over the sum of all the populations at risk. Note that this average is not the average of the county rates. Instead, it is calculated as the ratio of the total sum of all events over the total sum of all populations at risk (e.g., in our example, all the white female deaths in the state over the state white female population).

For more information, please read <https://geodacenter.github.io/workbook/3b_rates/lab3b.html>

**Synopsis**

```sql
float excess_risk(numeric event_variable, numeric base_variable)
```

Example

```sql
SELECT excess_risk(hr60::real, po60::real) OVER() FROM natregimes;

     excess_risk     
---------------------
                   0
                   0
                   0
                   0
   0.775047434799273
    4.49184458695377
    2.84060915923291
    ...
```

## 2. Empirical Bayes (EB) Smoothed Rate

In many applications, rates are used to estimate the underlying risk (such as disease or crime). However, when raw rates are used to estimate this underlying risk, differences in population size result in variance instability and spurious outliers. Rate smoothing is one way to address this variance instability. Essentially, rates are smoothed and thus stabilized by borrowing strength from other spatial units.

Empirical Bayes (EB) smoothing is based on a raw rate for each areal unit that is averaged with a separately computed reference estimate based on the whole study region, such as the overall population mean. This smoother is called Empirical Bayes because it borrows strength from a prior distribution to correct for the variance instability associated with rates that have a small base. It is empirical because the prior distribution is based on the global characteristics of the existing observations.

For more information, please read <https://geodacenter.github.io/workbook/3b_rates/lab3b.html>

**Synopsis**

```sql
float eb_rate(numeric event_variable, numeric base_variable)
```

Example

```sql
SELECT eb_rate(hr60::real, po60::real) OVER() FROM natregimes;

       eb_rate        
----------------------
 2.50736750244885e-06
  2.0205217184489e-06
 5.82506130964481e-06
 5.33541323884413e-06
    ...
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xunli.gitbook.io/postgeoda/1.-map-classification/1.2-rate-mapping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
