Memuat
Memuat
Outlier Detection (IQR and Isolation Forest) for Public Health and Epidemiology
0 views
Apply Outlier Detection (IQR and Isolation Forest) to synthetic data to prepare household health survey data on body weight and height for further analysis. Outlier detection with the IQR rule flags values beyond the quartile fences, while Isolation Forest isolates anomalous points in multivariate data. It is used to find extreme data before further analysis and decide how to treat them.

Apply Outlier Detection (IQR and Isolation Forest) to synthetic data to prepare household health survey data on body weight and height for further analysis.
| Role | Variable | Unit |
|---|---|---|
| Main | Body weight | kg |
| Supporting 1 | Height | cm |
| Supporting 2 | Age | tahun |
Of 279 observations, the IQR rule flags 39 and Isolation Forest flags 21 outliers in Body weight; the two methods agree with a Jaccard index of 0.395.
Computed from illustrative synthetic data, not from a real study.
Outlier detection with the IQR rule flags values beyond the quartile fences, while Isolation Forest isolates anomalous points in multivariate data. It is used to find extreme data before further analysis and decide how to treat them.
Report the count and percentage of outliers per method with the reason for the chosen treatment. Show results with and without outliers when they matter.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import IsolationForest
rng = np.random.default_rng(36)
n = 300
height = rng.normal(50, 5, n)
age = 0.8 * height + rng.normal(0, 3, n)
height[:5] += 30 # inject univariate outliers
age[5:8] -= 25 # inject multivariate outliers
body_weight = np.column_stack([height, age])
q1, q3 = np.percentile(height, [25, 75])
iqr = q3 - q1
lo, hi = q1 - 1.5 * iqr, q3 + 1.5 * iqr
mask_iqr = (height < lo) | (height > hi)
print("IQR fences:", round(lo, 2), round(hi, 2), "outliers:", int(mask_iqr.sum()))
iso = IsolationForest(contamination=0.03, random_state=36).fit(body_weight)
mask_if = iso.predict(body_weight) == -1
print("Isolation Forest outliers:", int(mask_if.sum()))
fig, ax = plt.subplots(1, 2, figsize=(10, 4))
ax[0].boxplot(height, vert=False); ax[0].set_title("x1 boxplot")
ax[1].scatter(height[~mask_if], age[~mask_if], s=10, label="Normal")
ax[1].scatter(height[mask_if], age[mask_if], c="r", s=25, label="Outlier")
ax[1].legend()
plt.tight_layout()
plt.show()Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$34
excl. 11% VAT
Duration: 7 working days
Output: Python files + result figures
Deliverables
Package 2 · most chosen
US$100
excl. 11% VAT
Duration: 13 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$222
excl. 11% VAT
Duration: 18-21 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Outlier Detection (IQR and Isolation Forest) is commonly used at this level in Public Health and Epidemiology. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output Python gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$34, Package 2 (your data analysis and interpretation) US$100 and Package 3 (full guidance) US$222, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. Python is a trademark of the Python Software Foundation.
Back to Python portfolio