This is an openaccess article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work, first published in JMIR mHealth and uHealth, is properly cited. The complete bibliographic information, a link to the original publication on http://mhealth.jmir.org/, as well as this copyright and license information must be included.
Body weight variability (BWV) is common in the general population and may act as a risk factor for obesity or diseases. The correct identification of these patterns may have prognostic or predictive value in clinical and research settings. With advancements in technology allowing for the frequent collection of body weight data from electronic smart scales, new opportunities to analyze and identify patterns in body weight data are available.
This study aims to compare multiple methods of data imputation and BWV calculation using linear and nonlinear approaches
In total, 50 participants from an ongoing weight loss maintenance study (the NoHoW study) were selected to develop the procedure. We addressed the following aspects of data analysis: cleaning, imputation, detrending, and calculation of total and local BWV. To test imputation, missing data were simulated at random and using real patterns of missingness. A total of 10 imputation strategies were tested. Next, BWV was calculated using linear and nonlinear approaches, and the effects of missing data and data imputation on these estimates were investigated.
Body weight imputation using structural modeling with Kalman smoothing or an exponentially weighted moving average provided the best agreement with observed values (root mean square error range 0.62%0.64%). Imputation performance decreased with missingness and was similar between random and nonrandom simulations. Errors in BWV estimations from missing simulated data sets were low (2%7% with 80% missing data or a mean of 67, SD 40.1 available body weights) compared with that of imputation strategies where errors were significantly greater, varying by imputation method.
The decision to impute body weight data depends on the purpose of the analysis. Directions for the best performing imputation methods are provided. For the purpose of estimating BWV, data imputation should not be conducted. Linear and nonlinear methods of estimating BWV provide reasonably accurate estimates under high proportions (80%) of missing data.
Recently, the idea of remote health care monitored through a network of internetconnected devices, termed
Body weight variability (BWV), that is, the variability around the overall trend in body weight, can be quantified from frequent body weight measures. Several recent studies have associated BWV with outcomes such as allcause mortality [
Although body weight is a reliable, valid, and simple metric to measure, its shortterm dynamics are not well understood because, until recently, it has been difficult and timeconsuming to make frequent longitudinal measures from an objective (ie, not selfreported) source, and previous studies estimating BWV generally use infrequent measurements (eg, every 612 months). Limitations in the methodologies used may contribute to the poor replicability of the results drawn from differing studies and populations: (1) definitions used and statistical inferences drawn from longitudinal weight data are extremely heterogeneous, (2) body weight changes are often measured retrospectively (by selfreport) and/or infrequently (12 months apart), (3) overall trends in body weight (eg, weight increase or decrease) are often not addressed appropriately and may confound independent effects of BWV, and (4) missing data are often not appropriately addressed. Simple linear approaches to the measurement of BWV (such as root mean square error [RMSE] around the linear trend) are not able to fully differentiate the overall trend from the variability component. New strategies must be developed to improve the estimation of BWV.
Using frequent body weight measurements, few studies have examined weekly [
Recently, we collected body weight data from WiFi–connected smart scales in individuals engaged in a weight loss maintenance trial (the NoHoW trial [
For the purpose of this analysis, a subsample of 50 individuals were selected from the 1627 participants in the NoHoW trial. The NoHoW study is a 2×2 randomized controlled trial (RCT) testing the efficacy of an information and communications technology–based toolkit for delivering a weight loss maintenance intervention structured around evidencebased strategies related to selfregulation and emotion regulation in the United Kingdom (Leeds), Denmark (Copenhagen), and Portugal (Lisbon). Full inclusion and exclusion criteria and procedures can be found elsewhere [
The selection of the 50 participants for this analysis was based on those who had the greatest number of weight measurements in the first 12 months of the trial. Selecting those with the greatest completeness of data allowed for (1) better ability to simulate missingness and test imputation performance and (2) more valid baseline estimation of BWV, which can be used to test the agreement with other estimations (in comparison with missing simulated and imputed data). Although the study was an RCT, the structure of the RCT was not used, and all its arms were collapsed. Only 50 individuals were chosen to limit missingness in the observed data, which increases with sample size. All participants were provided with a Fitbit Aria (Fitbit Inc) body weight scale linked to a personalized Fitbit account, and the data were retrieved via the Fitbit app programming interface to a webbased data hub. The device has been shown previously by others to have excellent agreement with a calibrated researchgrade SECA 769 scale [
Participant characteristics (N=50).
Characteristics  Values  



Male  15 (30)  

Female  35 (70)  
Age (years), mean (SD)  49.2 (9.3)  
Weight (kg), mean (SD)  81.9 (15.4)  
BMI (kg/m^{2}), mean (SD)  29.3 (6.8)  
Number of weight measurements, mean (SD)  336.0 (9.1) 
All statistical analyses were conducted using R version 3.5.1. All statistical codes used can be found in GitHub [
Study flow diagram. Outline of the study detailing the simulation validation study aimed to test imputation performance and calculation of linear and nonlinear body weight variability under conditions of true, missing, and imputed data sets with associated comparisons. BWV: body weight variability; MCAR: missing completely at random; NLMD: nonlinear mean deviation; RMSE: root mean square error; RPM: real patterns of missingness.
Data outliers may be present for numerous reasons such as (1) decalibration of electronic scales, (2) inconsistent weighing conditions (eg, clothed vs unclothed or morning vs night), (3) weighing of another person of similar weight (which may register as a rapid weight change on the same Fitbit account), and (4) incorrect manual entry of body weight. We defined the limits of physiological plausibility for weight change over given periods, which can be seen in
Typically, selfweighing is irregular, and thus, missing data are common. Missing data are generally categorized into missing at random (MAR), missing completely at random (MCAR), or not MAR [
Data imputation can be broadly divided into univariate and multivariate approaches. Univariate methods impute missing data based on information gained from a single variable (in this case, a time series [TS] of body weights), whereas multivariate algorithms can be used to infer predictive value from related variables [
In total, 7 univariate imputation algorithms and 3 multivariate analyses were run on all missingnesssimulated data sets. Univariate methods included (1) linear interpolation; (2) cubic spline interpolation; (3) Stine interpolation; (4) exponentially weighted moving average (EWMA); (5) structural modeling with Kalman smoothing (SMKS); (6) AutoRegressive Integrated Moving Average (ARIMA) statespace representation and Kalman smoothing (ASSRKS), all from the impute TS package [
Linear interpolation
This method looks for a straight line that passes between 2 values (Xa and Xb), where the imputed values are bound between Xa and Xb. It has been demonstrated to be efficient when predicting values with constant rate of change [
Spline interpolation
This method fits local polynomial functions, which are connected at each end to form a spline, creating a succession of cubic splines over successive intervals of the data [
Stine interpolation
This is an advanced interpolation method where interpolation occurs based on (1) whether values of the ordinates of the specified points change monotonically and (2) the slopes of the line segments joining the specified points change monotonically. It produces a smoothed imputation known to be robust against sporadic outliers and performs better than spline interpolations, where abrupt changes are observed [
Exponentially weighted moving average (EWMA)
This approach calculates the EWMA by assigning the value of the moving average window, which is user defined; the mean, thereafter, is calculated from equal number of observations on either side of a central missing value. The weighting factors decrease exponentially the greater distance from the missing value
Structural modeling with Kalman smoothing
This method aims to identify the structure (trend, seasonality, and error) in a time series (TS). Unlike AutoRegressive Integrated Moving Average (ARIMA) statespace approaches where each component is eliminated, these components are used to inform imputation of missing data. Kalman filter and smoothing works in 2 steps to (1) produce estimates of the current state variables, along with their uncertainties, and (2) update estimates using a moving average to give a smoothing effect [
ARIMA statespace representation and Kalman smoothing
This method converts the TS to an ARIMA model by decomposing the trend, seasonality, and error through a differencing protocol, resulting in a stationary TS where means and covariances would remain invariant over time [
TsClean [
This method first assesses evidence of seasonality. If present, a robust seasonaltrend decomposition for seasonal series is conducted followed by linear interpolation. If no seasonality is present, Friedman’s super smoother [
Knearest neighbors [
For every observation to be imputed, this algorithm locates
Random forest [
This method is an extension of typical classification and regression, which generates predictive models that recursively subdivide the data based on values of the predictor variables. It does not rely on parametric assumptions and can accommodate nonlinear interactions, although it may be prone to overfitting [
Predictive means matching [
For each missing entry, this method generates a small set of candidate donors from all complete cases that have predicted values closest to the predicted value for the missing entry. One donor is randomly drawn from the candidates, and the observed value of the donor is taken to replace the missing value. The assumption is the distribution of the missing cell is the same as the observed data of the candidate donors
We estimated BWV using 2 discrete methods in the observed data as well as in all simulated and imputed data sets. These methods are illustrated in
First, the series of body weights was detrended for each individual. Detrending is a necessary step in the decomposition of a TS. It can be used to isolate the variability component of the series from the overall trend, resulting in a combination of seasonal patterns (eg, any repetitive patterns including withinweek) and random noise. First, a locally estimated scatterplot smoothing (LOESS) regression was fitted to each participant (
The detrending process centers body weight around 0. The centered weights were converted to relative centered weights by dividing the centered weight by the observed weight at each time point (
Performance summaries of univariate and multivariate imputation. Boxplots of the errors associated with imputation of body weight data collected by smart scales. Data was removed by a missing completely at random algorithm (left plots) and also informed by real patterns of missingness (right plots) in increments of 20%, 40%, 60% and 80%. Imputation was done by 7 univariate methods (top plots) and 3 multivariate methods (bottom plots). Root mean square error was used as the performance metric. ASSRKS: ARIMA statespace representation and Kalman smoothing; EWMA: exponentially weighted moving average; KNN: KNearest neighbors; Lin Int: linear interpolation; PMM: predictive means matching; RF: random forest; RMSE: root mean square error; SMKS: structural modelling with Kalman smoothing; Spline int: spline interpolation; Stine int: stine interpolation.
There are legal restrictions on sharing data from this study that contain potentially identifying or sensitive personal information. The restrictions are imposed by the Danish Data Protection Agency Data used in this study will be made available upon request after application to the NoHoW data controller (the James Hutton Institute). The application procedure can be obtained from the James Hutton Institute (DPO@hutton.ac.uk) or David Nutter (david.nutter@bioss.ac.uk).
All imputation algorithms were run on each simulated data set, generating 28,000 and 12,000 imputed data sets from MCAR and RPM simulations, respectively (4000 imputed data sets per imputation method). The performance of each imputed data set in comparison with the observed weight data was evaluated using the RMSE, which is commonly used for performance evaluation [
The results were grouped by imputation strategy and proportion of missingness. A summary of the performances is illustrated using the RMSE in
Illustration of linear and nonlinear calculation of body weight variability. Scatterplots represent an example of a single participant with a nonlinear weight trajectory over 12months. Figure (A) shows a linear trendline fitted to the data with (B) the trendline subtracted and the associated residuals plotted. Figure (C) shows a nonlinear locally estimated scatterplot smoothing regression fitted to the data with (D) the trendline subtracted and the associated residuals plotted. RMSE: root mean square error.
Next, we investigated the agreement between BWV estimations from observed data sets and simulated and imputed data sets for each participant. First, data sets simulated by MCAR and RPM were combined. For simulated data sets (ie, those with missing data), the errors were minimal, reaching an average of 7% (SD 15.4) and 3.2% (SD 19.5) disagreement between the true weight variability (WV) estimates and estimates made on 80% missing data for nonlinear and linear BWV calculation methods, respectively. At 60%, 40%, and 20% of missing data, errors were 2.3% (SD 9.1) and 0.6% (SD 7.3), 1.3% (SD 6.4) and 0.4% (SD 9.8), and 0.4% (SD 6.9) and 0.2% (SD 6.0) for nonlinear and linear WV estimates, respectively, compared with true estimates. The full results can be viewed in
Influence of data imputation on linear and nonlinear body weight variability estimates. Caption: Boxplots of the relative errors associated with calculation of body weight variability in body weight data collected by smart scales when using 10 different imputation methods imputing data in increments of 20%, 40%, 60%, and 80%. Errors represent the deviation from estimates made from observed data sets. ASSRKS: ARIMA statespace representation and Kalman smoothing; EWMA: exponentially weighted moving average; KNN: Knearest neighbors; NLMD: nonlinear mean deviation; PMM: predictive means matching; RF: random forest; RMSE: root mean square error; SMKS: structural modeling with Kalman smoothing.
In this study, we proposed a method for processing body weight data acquired from electronic smart scales, with both general and specific applications (to BWV). The analysis was produced in response to the increasing use of smart scales in clinical and research environments [
We considered 7 univariate and 3 multivariate approaches to imputation. As access to further individuallevel information (eg, participant characteristics or behavioral patterns and psychological traits) may be unavailable, body weight data collected by smart scales may be treated as univariate, and therefore, the use of more advanced approaches to multivariate imputation such as treebased models, neural networks, and KNN methods is limited. To test multivariate imputation algorithms, we added day number (ie, day of trial) and day of the week as predictive variables, as these can be automatically collected in freeliving environments without any participant burden. Withinweek (eg, weekday vs weekend) fluctuations in body weight have been shown previously [
We proposed a method of estimating BWV using a nonlinear approach, which we termed NLMD. This was devised to address the assumption of linearity associated with RMSE estimations commonly used. Using a nonlinear approach, the trendline is fitted more closely to the data. The result is the ability to identify daytoday variability or withinweek patterns. In contrast, in the case of curvilinear weight trends, RMSE generates large residual errors; this may be more suitable when the aim is to detect larger fluctuations over several months or years. We found that BWV estimates from data sets with simulated missingness were similar to true estimates, using both RMSE and NLMD methods. Surprisingly, using our current methods, BWV estimates were not greatly different between complete and 80% missing data sets (3.2%, SD 0.2% and 7.0%, SD 0.2% for RMSE and NLMD methods, respectively). However, when these missing data were imputed, substantial biases were introduced largely as underestimations, which increased for each increment of imputed data. As such, although our imputationvalidation analysis may inform general imputation of body weight data for numerous other purposes, for the purpose of estimating BWV, we advise that data be left as missing.
To our knowledge, no previous study has examined longterm BWV from electronic smart scales, and only a few studies have modeled frequent weight data using TS methods. A recent study examining the effect of breaks in selfweighing on weight outcomes used a linear mixed model approach using time and weight as fixed predictor and response variables, respectively [
This study has several strengths. First, we developed our data processing methods from true rather than simulated data, thus increasing the validity of the analysis. Our simulationimputation analysis was comprehensive, including the generation of 8000 missingnesssimulated data sets in total with varying levels of missingness using both random and realmissingness informed simulations, which resulted in 80,000 imputed data sets produced using 10 univariate and multivariate algorithms. Next, we described and compared both linear and nonlinear approaches to estimating BWV under different conditions of missingness and reported the errors produced in the common case of missing data, which should inform the magnitude of errors expected from missing data estimations in future studies. Some limitations should also be addressed. First, all imputation methods were deterministic, although body weight seems to be a relatively stochastic (ie, randomly determined) process. The resultant effect is that imputation may reduce the variability by attempting to recognize predictive patterns that are not there. We recommend that consideration should be given to whether imputation is necessary. In some analyses, including instances where machine learning algorithms are employed, complete data are a necessity; therefore, imputation is required. Next, we did not have entirely complete data by which to test imputation, although we opted to use real rather than simulated data for external validity.
BWV potentially represents (1) a significant health risk and (2) a prognostic tool that is currently not well understood or well measured. This study evaluated the performance of various imputation methods applied to body weight data and presented a protocol for estimating BWV under varying amounts of missing data. We showed that structural modeling with a Kalman smoother and EWMA performed an imputation most effectively. However, in the case of estimating BWV, the imputations generally produced large underestimations due to the tendency to revert toward the mean. Furthermore, we demonstrated the errors associated with BWV estimates at varying levels of missing data, concluding that errors are small when using both linear and nonlinear methods even under high proportions of missingness. In future, the importance of both frequent measurement of body weight and consistent and appropriate methods of analyzing the data produced should be underlined in the study of BWV.
Outlier detection limits based on physiological plausibility.
Detailed description of the data removal processes.
Illustrated examples of body weight imputation by all methods.
Table of imputation performance by root mean square error.
Summary figures of imputation performance by mean absolute percentage error and mean absolute error.
Table of mean errors in body weight variability calculation following simulation and imputation.
AutoRegressive Integrated Moving Average
ARIMA statespace representation and Kalman smoothing
body weight variability
exponentially weighted moving average
Knearest neighbors
locally estimated scatterplot smoothing
missing at random
missing completely at random
nonlinear mean deviation
predictive means matching
randomized controlled trial
random forest
root mean square error
real patterns of missingness
structural modeling with Kalman smoothing
time series
weight variability
The authors wish to thank all the individuals who were involved in the collection of data at the University of Leeds, the University of Lisbon, and the Capital Region of Denmark. The NoHoW study received funding from the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 643309) in addition to an Engineering and Physical Sciences Research Council (grant no: EP/R511717/1).
JS, AL, SL, and BH were involved in the design of the NoHoW trial. JT, RO, and RS were involved in the conception of this study. JT and RO were involved in the development of the protocol and data analysis. JT was primarily responsible for writing the manuscript. All authors reviewed and edited the manuscript and approved the final version of the manuscript.
RJS consults for Slimming World via consulting Leeds, a whollyowned subsidiary of the University of Leeds. All other authors have no conflicts of interest to declare.