Activity Self-Tracking with Smart Phones: How to Approach Odd Measurements?

Activity Self-Tracking with Smart Phones: How to Approach Odd Measurements?

Gabriela Villalobos-Zúñiga
University of Lausanne Mauro Cherubini
University of Lausanne

Tracking physical activity reliably is becoming central to many research efforts. In the last years specialized hardware has been proposed to measure movement. However, asking study participants to carry additional devices has drawbacks. We focus on using mobile devices as motion sensors. In the paper we detail several issues that we found while using this technique in a longitudinal study involving hundreds of participants for several months. We hope to sparkle a lively discussion at the workshop and attract interest in this method from other researchers.

  Activity Self-Tracking with Smart Phones: How to Approach Odd Measurements?

Gabriela Villalobos-Zúñiga

University of Lausanne Mauro Cherubini

University of Lausanne

Figure 1: Seasonality Effect - General Curve of Means. The "pulse" regularity is an indication of seasonality effects.


Author Keywords

Long-Term Self-Tracking; Health; Physical Activity; Longitudinal study; Apple HealthKit

ACM Classification Keywords

H.5.m [Information interfaces and presentation (e.g., HCI)]: Miscellaneous


Physical inactivity is the fourth leading risk factor for global mortality 111,last retrieve February 2018.. Diseases such as coronary heart disease, type 2 diabetes, breast and colon cancers are caused by insufficient physical activity. Furthermore, the lack of moderate intensity physical activity, is responsible for 9% of premature mortality and 3.2 million deaths globally [?]. Due to the overwhelming scientific evidence on the benefits of physical activity [?], it becomes clear the necessity to implement mechanisms to increase the physical activity levels worldwide. Guidelines recommend adults to practice a moderate-intensity physical activity for at least 30 minutes a day during 5 days a week [?].

The points raised before justify the growing body of research aiming to analyze, support and/or enhance human activities through the means of technology [?],[?],[?],[?]. These research efforts focus on diverse populations: diabetics [?], cancer survivors [?],[?], children [?], etc. being their common goal to attain the adoption and/or maintenance of physical activity. Furthermore, industry is as well engaged in the implementation of technology supported means to stimulate physical activity. Examples of these include, fitness coaching apps222E.g.,, last retrieved February 2018., and run tracking applications333Eg.,, last retrieved February 2018..

From a hardware standpoint, there has been a growing number of specialized devices that have been developed to sense human activity. These include bracelets, clips444Eg.,, last retrieved February 2018 or wearable sensors555Eg.,, last retrieved February 2018.. While as consumer products these devices are great, as research devices they suffer serious limitations. For instance, users might forget to wear them consistently, or their battery could run out of power if not systematically recharged. These points –among others– persuaded us to reconsider employing just smart phones without any additional hardware as a tool for tracking steps.


Using Smart Phones To Track Steps

An elegant solution to these limitations is that of using smart phones as sensors of physical activity. These can accurately predict walking activity [?] and have been previously used to measure physical exercise [?],[?]. Moreover, they have the following advantages: they act as silent observers, letting participants carry on with their tasks without an explicit reminder of being tracked, thus making the data capturing less intrusive. Furthermore, people are willing to carry their phones with them during the majority of their daily activities and are also aware of the level of battery these have because they want to remain active in their social networks (e.g., Facebook, Snapchat, Twitter, Instagram) and reachable to instant messaging and calls (e.g., Whatsapp, Skype, SMS). The fact that most of day-time period users carry their phones, diminishes the negative factors that come naturally with the usage of trackers where users forget to charge it or wear it. Finally, another methodological advantage of using the smart phone as a sensor is that it does not require participants to use additional hardware that they usually would not, thus increasing the ecological validity of the study.

Of the different hardware solutions, we focus on the iPhone because Apple has standardized both the hardware and the API with which we can collect activity data, furthermore its use diminishes the development costs required to build the experimental infrastructure for a study.

Apple’s HealthKitTM is a platform with a repository of physical activity data collected from the iPhone’s accelerometer and other health data obtained from various sensors such as scales and blood testing devices. Data collected is stored in an encrypted database called Healthkit Store from which steps are retrieved666HealthKit also collects data from a variety of other sensors. However, in the context of this paper we focus only on steps measurements.. Researchers have made use of this platform in the past to implement steps tracking applications [?],[?],[?].

As part of ongoing research we used Apple’s HealthKitTM platform as a sensor to collect physical activity data. The goal of this paper is to discuss advantages and disadvantages of this method, and to report specific issues we encountered and possible solutions. We plan to contribute to the workshop by sparkling interest in this method and discussion on how to address some of the issues that we encountered.

Adversities of Tracking Steps With a Smart Phone

We are currently using Apple’s Health KitTM to record the physical activity of users as part of a research project. The study involves an longitudinal observation period of 6 months. 230 students are currently participating in this research(62% female and 38% male), average age of 21(SD = 2.3). Data capture started in June 2017 and it is still ongoing. While analyzing the data, we observed a number of issues that we would like to discuss here.

margin: margin:

Unreliability of the sensor to very low physical activity: We observed a conspicuous number of days for which the activity sensors provided unreliable data. These are days which correspond to extremely low physical activity of the participants. During those days, the sensor was unable to provide an accurate measure of the activity of the participants providing counts equal to zero or little steps or returning a NA (i.e., not available) altogether. Obviously, this does not correspond to reality as we interviewed participants and indeed they moved during these days. See Table LABEL:tab:table1 for descriptive statistics of the steps distribution. We are still unsure of why this happens. This could be due to the inability of the internal accelerometer and its corresponding signal processing algorithm to distinguish human steps when the pace is shorter or slower than usual (e.g., moving indoor vs. outdoor). Solution: Our short-term solution to this problem is that of discarding low activity values. To do that we plotted a histogram of the collected steps and noticed skewness towards zero of the distribution curve. We took the logarithmic-transform of the curve and noticed that to make it symmetrical we should remove measurements below 400 steps. See Figures LABEL:fig:histograms1 and LABEL:fig:histograms2 for context.

Health App configuration changes: In order for Health KitTM to record steps, the user needs to grant permission to access sensor data. This is is verified by turning on the Fitness Tracking switch on the iPhone menu Settings->Privacy->Motion & Fitness. In our study we noticed periods in which despite of receiving normal data since the beginning of the study we suddenly started obtaining zeros, see Figure LABEL:fig:micro-holes. When contacting participants and verifying their iPhone configuration we noticed that the Fitness Tracking switch was turned off, resulting in the inability of the sensor to register steps. Another similar issue occurred when the participant did not grant our research application the rights to access Health data, from which we retrieve the number of steps. Solution: Our practical solution was to contact directly these participants and follow a step by step procedure to verify that all the configuration parameters were set up accordingly. We also implemented a feature in the research application that checked the settings whenever the application was opened. If these were turned off, the user was redirected to the Motion & Fitness settings to turn the switch back on.

Micro-holes in the dataset: We observed an evident number of days in which the count of steps was reported zero. This occurs randomly across the dataset. See Figure LABEL:fig:micro-holes. We believe this appears due to a technical error in the sensor that prevents it from recording steps. Solution: Our solution approach is the same as the one employed for unreliability of the sensor to very low physical activity.

margin: margin: margin:

Macro-holes in the dataset: There is no activity recorded for several consecutive days. We believe that these ’macro-holes’ are generated in two distinct situations: in some cases, we observe continuous zeros for some participants at the onset of the study. The justification for this is that the research application was not yet installed into the participant’s device, therefore no permission to access sensor data was granted. In some other cases, if the macro-hole is found in the middle of the study, this might be caused by the participant who turned off the permission for our app to access the sensor data. See Figures LABEL:fig:macro-holes1 and LABEL:fig:macro-holes2. Solution: The approach here is to use a statistical analysis method that is able to deal with missing data. We chose to use Linear Mixed-Effects Regression (or LMER). Each subject in these LMER models may vary in terms of the number of measurement occasions. Subjects who are missing data at a given time point are not excluded from the analysis. In considering missing data and whether they are ignorable or not, a related issue is the distinction between attrition (i.e., subjects dropping out of the study and not returning) and sporadic or intermittent data (i.e., subjects with missing data between observed time-points). Attrition should be consider carefully and might not be ignored. Participants where consistent attrition is observed should be removed from the analysis.

Plateau in the dataset: We noticed data for which in a particular moment in time augmented until reaching above 10’000 steps a day and remained constant for some months. We believe participants in this situation were trying to reach the daily step goal we set to 10’000 steps. See Figure LABEL:fig:plateau. Solution: It is still not clear in our analysis whether these participants cheated by tampering the sensor or whether they actually had physical activity consistently above the set threshold of 10K steps for several weeks in a row. To counter people who wanted to cheat in the experiment, we explicitly excluded manually entered steps from the step count. However, participants might have found new creative ways to cheat that we have not identified yet.

Seasonality effects: Physical activity of the participants was influenced by the summer holiday season (July and August). Period in which participants tend not to carry their phone or they perform more or less exercise than their normal average. Similarly, occurs during weekdays and weekends in which people tend to be less active in the later one. These effect creates uncertainty in the effects of the treatment of the study by not allowing to clearly determine what increased or decreased the physical activity. See Figure Activity Self-Tracking with Smart Phones: How to Approach Odd Measurements?. Solution: Our solution for this case consists in removing the seasonality effects by putting in practice methods borrowed from time-series analysis such as effect decomposition.


Determining the correct type of devices to track data for research studies is critical for their validity. This decision might depend on the design of the experiment and the specific research questions the researchers are tackling. In some cases it might be adequate to ask participants to carry additional hardware, in others it might not. We argue that even with the limitations presented in this position paper, using smart phones as sensor of physical activity is a powerful mechanism to study human activity and a valid research method. There are a number of open questions that we would like to ask the audience and get feedback on during the workshop.

Which method should we use to process micro-holes in the dataset? There are two possible solutions to this: either we use the last-value carried forward (or LVCF) or interpolation between two known measurements. While the former is more respectful of the auto-regressive nature of longitudinal data [?], the latter is not. We would like to hear expert opinions on this issue.


What are the possible explanations for NAs being returned from Apple HealthKitTM? We know little of the inner working of the sensor and the built-in algorithm that process the accelerometer signals in order to understand the fringe cases that we observed. We would like to ask the audience whether any technical documentation is available on this specific hardware or any engineer who might have reverse-engineered the inner working of this black box.

Removing seasonality effects or keeping them in the data? We are still unsure whether the best method to analyze longitudinal data is that of removing the seasonality effects. Contrary to time series, where measurements are said to be independent, data coming from longitudinal studies have an auto-regressive nature that we should not ignore. Seasonality is certainly part of how people behave: activity on week days might be consistently lower for many users. Should we remove this effects?

How to best exploit iPhone background execution mode for experimental purposes? Apple allows background mode for specific purposes such as: playing audio, receiving location updates, performing finite-length task, and background fetch (e.g. news retrieval). Unfortunately none of those fit out need, and this forced us to ask our participants to open the application periodically (bring it to foreground mode) so we could retrieve the steps from HealthKitTM . Avoiding intervening so directly into the experiment, would increase the ecological validity of the study. Recently, we found a mechanism in which by using the option : UIApplicationBackgroundFetchIntervalMinimum we are able to overcome this issue. Nonetheless, we would love to discuss whether other solutions to this problematic have been exploited successfully.

Conclusion and Next Steps

Having clear/reliable data is central to long-term self tracking, hence the importance of working with precise and solid measure instruments. Researchers can make use of the variety of trackers that are offered by the market, however all existing solutions have drawbacks. With the purpose of obtaining valid results, it is imperative that researchers find workarounds to standing issues, making the discussion of these problems highly relevant for the research community.

In a follow-up study we are planning to improve the quality of the data we capture working on the different aspects discussed in this paper.


Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description