function calculateRatePer100k() {
// 1. Get DOM elements
var eventInput = document.getElementById('eventCount');
var popInput = document.getElementById('totalPop');
var popError = document.getElementById('popError');
var resultBox = document.getElementById('resultBox');
// 2. Parse values
var events = parseFloat(eventInput.value);
var population = parseFloat(popInput.value);
// 3. Reset error state
popError.style.display = 'none';
// 4. Validation
if (isNaN(events) || events < 0) {
alert("Please enter a valid number of events.");
return;
}
if (isNaN(population) || population <= 0) {
popError.style.display = 'block';
return;
}
// 5. Calculation Logic
// Formula: (Events / Population) * 100,000
var rawFraction = events / population;
var rate100k = rawFraction * 100000;
// Secondary calculations for context
var rate1k = rawFraction * 1000;
var rate10k = rawFraction * 10000;
var percentage = rawFraction * 100;
// 6. Formatting
// We use toLocaleString to add commas for readability, and fix decimals
var formatted100k = rate100k.toFixed(2);
// If the number is whole, remove decimals
if (rate100k % 1 === 0) {
formatted100k = rate100k.toFixed(0);
}
// 7. Display Results
document.getElementById('finalRate').innerHTML = formatted100k;
document.getElementById('rawPercent').innerHTML = percentage.toFixed(4) + '%';
document.getElementById('ratePer1k').innerHTML = rate1k.toFixed(2);
document.getElementById('ratePer10k').innerHTML = rate10k.toFixed(2);
resultBox.style.display = 'block';
}
Understanding the Rate per 100,000
Calculating a rate per 100,000 is a standard statistical method used to compare data across populations of different sizes. It effectively normalizes data, allowing for fair comparisons between a small town and a large metropolis. This metric is widely used in epidemiology, criminology, and demographic studies.
The Formula
The calculation is straightforward. You divide the number of observed events (such as crimes, disease cases, or accidents) by the total population, and then multiply the result by 100,000.
Formula:
(Number of Events ÷ Total Population) × 100,000 = Rate
Why Use Rate per 100,000?
Raw numbers can be misleading. Consider this scenario:
City A has 500 incidents of a specific event and a population of 1,000,000.
Town B has 50 incidents of the same event and a population of 10,000.
Looking at raw numbers, City A seems worse (500 vs 50). However, when we calculate the rate per 100,000:
City A Rate: (500 ÷ 1,000,000) × 100,000 = 50 per 100k
Town B Rate: (50 ÷ 10,000) × 100,000 = 500 per 100k
The calculation reveals that the prevalence of the event is actually 10 times higher in Town B than in City A, despite the lower raw count.
Common Applications
This metric is essential for various sectors:
Public Health: Tracking disease infection rates (incidence) or mortality rates.
Law Enforcement: Comparing crime statistics across different jurisdictions (e.g., violent crime rate per 100,000 residents).
Traffic Safety: analyzing accident rates relative to the population size.
How to Interpret the Results
A rate of "X per 100,000" means that if you took a random sample of 100,000 people from that specific population, you would statistically expect X number of them to be associated with the event. This provides a standardized baseline regardless of the actual population size.