The computation of smartphone orientation is an important step in the process of pedestrian indoor localization, for example, when providing navigation to a certain location (Ehrlich & Blankenbach, 2018;Moder et al., 2018) or using the movement behavior of persons to gain insight into building utilization (Burgess et al., 2018;Kanda et al., 2007). We propose a new orientation-estimation algorithm (OEA) based on self-contained sensors, with a focus on magnetometer integration to provide robust absolute smartphone heading information.The magnetometer observation model exhibits classical internal sensor errors such as those related to bias, scale factor, and misalignment (Renaudin et al., 2010) as well as platform-and environment-dependent errors such as hard-iron bias, soft-iron scaling, and magnetic anomaly bias (Groves, 2013). These latter errors are the primary reason that magnetometer integration in OEAs can cause large deviations in heading estimations. Routines for determining and mitigating these