Incidence Rate Sample Size Calculator
.ir-calc-wrapper {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background: #fff;
border: 1px solid #e0e0e0;
border-radius: 8px;
}
.ir-calc-header {
text-align: center;
margin-bottom: 30px;
background: #f8f9fa;
padding: 20px;
border-radius: 6px;
}
.ir-calc-header h2 {
margin: 0;
color: #2c3e50;
}
.ir-row {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 20px;
}
.ir-col {
flex: 1;
min-width: 250px;
}
.ir-label {
display: block;
font-weight: 600;
margin-bottom: 8px;
color: #333;
}
.ir-input {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box;
}
.ir-select {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
background-color: white;
box-sizing: border-box;
}
.ir-help {
font-size: 12px;
color: #666;
margin-top: 4px;
}
.ir-btn {
width: 100%;
padding: 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background 0.2s;
margin-top: 10px;
}
.ir-btn:hover {
background-color: #0056b3;
}
.ir-results {
margin-top: 30px;
background-color: #f0f7ff;
border: 1px solid #cce5ff;
border-radius: 6px;
padding: 20px;
display: none;
}
.ir-result-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.ir-metric {
background: white;
padding: 15px;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
text-align: center;
}
.ir-metric-label {
font-size: 13px;
text-transform: uppercase;
letter-spacing: 0.5px;
color: #555;
margin-bottom: 5px;
}
.ir-metric-val {
font-size: 28px;
font-weight: 800;
color: #007bff;
}
.ir-metric-sub {
font-size: 12px;
color: #777;
}
.ir-explanation {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.ir-explanation h3 {
font-size: 18px;
margin-bottom: 15px;
color: #333;
}
.ir-explanation p {
font-size: 15px;
line-height: 1.6;
color: #444;
margin-bottom: 15px;
}
.ir-explanation ul {
margin-left: 20px;
margin-bottom: 20px;
}
.ir-explanation li {
margin-bottom: 8px;
font-size: 15px;
color: #444;
}
@media (max-width: 600px) {
.ir-result-grid {
grid-template-columns: 1fr;
}
}
Estimated Incidence Rate (%)
Percentage of the population that qualifies (p).
Desired Margin of Error (%)
Acceptable error range (e.g., +/- 5%).
Confidence Level
90% Confidence
95% Confidence (Standard)
99% Confidence
Population Size (Optional)
Total size of the target group (N).
Fieldwork Planning (Optional)
Est. Response Rate (%)
Percentage of invites who will participate.
Calculate Sample & Screening Needs
Calculation Results
Required Completes (n)
–
Valid surveys needed
Screening Volume
–
People to screen at % IR
Total Invites Needed
–
Based on % Response Rate
Efficiency Ratio
–
1 complete per contacts
Interpretation: To achieve a margin of error of +/- % at a % confidence level with an incidence rate of %, you must obtain completed surveys . To get these completes, you need to screen approximately individuals.
How to Calculate Sample Size from Incidence Rate
When conducting market research or statistical analysis, the Incidence Rate (IR) is the percentage of the general population that possesses the specific criteria or trait you are studying. Calculating sample size based on incidence rate involves two distinct steps:
1. Statistical Sample Size (Completes)
First, you must calculate how many valid completed surveys (n) you need to ensure your data is statistically significant. The formula uses the incidence rate (p) as the measure of variability.
Formula: n = (Z² * p * (1-p)) / e²
Z: Z-score (1.96 for 95% confidence).
p: Incidence Rate (expressed as a decimal, e.g., 0.20).
e: Margin of Error (expressed as a decimal, e.g., 0.05).
Note: Unlike generic calculators that assume p = 0.5 (50%) for maximum sample size, using your specific lower incidence rate often yields a smaller required sample size for that specific variable, though precision decreases if you analyze sub-groups.
2. Fieldwork Screening Volume
Once you know you need n completes, you must calculate how many people to contact to find them. This is heavily dependent on the Incidence Rate.
Formula: Screening Required = Required Completes / Incidence Rate
For example, if you need 400 completes and your incidence rate is 10% (0.10):
400 / 0.10 = 4,000 people must be screened to find your 400 targets.
function calculateSampleSize() {
// 1. Get Input Values
var incidenceRateInput = document.getElementById('incidenceRate').value;
var marginErrorInput = document.getElementById('marginError').value;
var confidenceLevel = parseFloat(document.getElementById('confidenceLevel').value);
var populationSizeInput = document.getElementById('populationSize').value;
var responseRateInput = document.getElementById('estResponseRate').value;
// 2. Validation
if (!incidenceRateInput || !marginErrorInput) {
alert("Please enter both Incidence Rate and Margin of Error.");
return;
}
var p = parseFloat(incidenceRateInput) / 100; // Incidence as decimal
var e = parseFloat(marginErrorInput) / 100; // Margin of error as decimal
var N = populationSizeInput ? parseFloat(populationSizeInput) : Infinity;
var respRate = responseRateInput ? parseFloat(responseRateInput) / 100 : 0.1;
if (p = 1) {
alert("Incidence rate must be between 0.1 and 100.");
return;
}
// 3. Calculate Base Sample Size (Cochran's Formula)
// n = (Z^2 * p * (1-p)) / e^2
var numerator = Math.pow(confidenceLevel, 2) * p * (1 – p);
var denominator = Math.pow(e, 2);
var sampleSize = numerator / denominator;
// 4. Finite Population Correction (if N is provided)
if (N !== Infinity && N > 0) {
sampleSize = sampleSize / (1 + ((sampleSize – 1) / N));
}
// Round up sample size (can't have half a person)
var requiredCompletes = Math.ceil(sampleSize);
// 5. Calculate Screening Needs
// To get 'requiredCompletes' valid responses at 'p' incidence:
// Screened = Completes / p
var screeningNeeded = Math.ceil(requiredCompletes / p);
// 6. Calculate Invites Needed
// Invites = ScreeningNeeded / ResponseRate
var invitesNeeded = Math.ceil(screeningNeeded / respRate);
// 7. Calculate Efficiency Ratio (Total Invites / Completes)
var ratio = (invitesNeeded / requiredCompletes).toFixed(1);
// 8. Update Display
document.getElementById('resultsArea').style.display = 'block';
// Format numbers with commas
document.getElementById('finalSampleSize').innerText = requiredCompletes.toLocaleString();
document.getElementById('screeningNeeded').innerText = screeningNeeded.toLocaleString();
document.getElementById('totalInvites').innerText = invitesNeeded.toLocaleString();
document.getElementById('efficiencyRatio').innerText = "1:" + ratio;
document.getElementById('ratioVal').innerText = ratio;
// Update Text Spans
document.getElementById('dispIncidence1').innerText = incidenceRateInput;
document.getElementById('dispIncidence2').innerText = incidenceRateInput;
document.getElementById('dispResponse').innerText = (respRate * 100);
document.getElementById('dispError').innerText = marginErrorInput;
// Update Confidence Text
var confText = "95";
if(confidenceLevel === 1.645) confText = "90";
if(confidenceLevel === 2.576) confText = "99";
document.getElementById('dispConf').innerText = confText;
document.getElementById('txtSample').innerText = requiredCompletes.toLocaleString();
document.getElementById('txtScreen').innerText = screeningNeeded.toLocaleString();
}