In countries like Japan, Australia, France, Denmark, and South Korea, the numbers of single-person households and older adults living alone have been steadily increasing each year, leading to the social issue of lonely deaths among older adults. Against this backdrop, this study proposes a method to develop a system for preventing lonely deaths based on information technology, including the Internet of Things (IoT). IoT sensor data, which include nine environmental variables such as indoor temperature, relative humidity, CO2 concentration, fine dust particle levels, illuminance, total volatile organic compound levels, and occupancy data collected from passive infrared sensors, provide empirical evidence so that anomalies can be detected in the behavior patterns of older adults when they remain in one place for an unusually long time. Detecting such risky situations for older adults living alone involves anomaly detection through occupancy monitoring. The data from occupancy monitoring were analyzed using four classification models, namely Logistic Regression, k-Nearest Neighbor, Decision Tree, and Random Forest, with the performance of occupancy detection being compared across these models. Furthermore, the method proposed in this study includes data processing for environmental variables to improve the performance of occupancy detection.