Single-subject health data are becoming increasingly available thanks to advances in self-tracking technology (e.g., wearable devices, mobile apps, sensors, implants). Many users and health caregivers seek to use such observational time series data to recommend changing health practices in order to achieve desired health outcomes. However, there are few available causal inference approaches that are flexible enough to analyze such idiographic data. We develop a recently introduced causal-analysis framework based on n-of-1 randomized trials, and implement a flexible random-forests g-formula approach to estimating a recurring individualized effect called the "average period treatment effect". In the process, we argue that our approach essentially resembles that of a longitudinal study by partitioning a single time series into periods taking on binary treatment levels. We analyze six years of the author's own self-tracked physical activity and weight data to demonstrate our approach, and compare the results of our analysis to one that does not properly account for confounding.