Skip to content

geodalib / core/src / empiricalBayes

Function: empiricalBayes()

empiricalBayes(baseValues, eventValues): number[]

Defined in: core/src/mapping/rates.ts:162

Description

Compute the empirical Bayes smoothed rates using the Poisson-Gamma model.

The EB estimate for risk in location i is: πiEB=wiri+(1wi)θ

where:

  • ri is the crude (raw) rate
  • θ is the reference rate (prior mean)
  • wi is the weight calculated as: wi=σ2/(σ2+μ/Pi)
  • Pi is the population at risk in area i
  • μ and σ2 are the mean and variance of the prior distribution

The method:

  1. Estimates θ (theta1) as the reference rate: Oi/Pi
  2. Estimates σ2 (theta2) using the formula: (Pi(riμ)2/Pi)μ/(Pi/n)
  3. If σ2 is negative, sets it to 0 (conventional approach)
  4. Computes weights and final smoothed rates

Small areas (with small population at risk) will have their rates adjusted considerably, while larger areas will see minimal changes.

Parameters

baseValues

number[]

The values of base variable (P_i, population at risk).

eventValues

number[]

The values of event variable (O_i, observed events).

Returns

number[]

The empirical Bayes smoothed rates.