This calculator helps you determine the mortality rate per 1,000 individuals within a specific population and timeframe. The mortality rate is a key indicator in public health and epidemiology, used to understand the frequency of death in a population. It's often calculated for a specific cause of death, age group, or a general overview.
The mortality rate per 1,000 is:
function calculateMortalityRate() {
var totalDeathsInput = document.getElementById("totalDeaths");
var populationSizeInput = document.getElementById("populationSize");
var mortalityRateResultDiv = document.getElementById("mortalityRateResult");
var totalDeaths = parseFloat(totalDeathsInput.value);
var populationSize = parseFloat(populationSizeInput.value);
if (isNaN(totalDeaths) || isNaN(populationSize) || populationSize <= 0) {
mortalityRateResultDiv.textContent = "Invalid input. Please enter valid numbers for deaths and population size, and ensure population size is greater than zero.";
return;
}
// Formula: (Total Deaths / Total Population) * 1000
var mortalityRate = (totalDeaths / populationSize) * 1000;
mortalityRateResultDiv.textContent = mortalityRate.toFixed(2); // Displaying with 2 decimal places
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="number"] {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 10px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
padding: 10px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #f9f9f9;
}
#mortalityRateResult {
color: #28a745;
font-weight: bold;
}