« Reading List: Without Warning | Main | Reading List: The Lightness of Being »

Sunday, March 8, 2009

The Hacker's Diet Online: Trend computation in monthly logs changed

I have just put a new version (Build 5017) of The Hacker's Diet Online into production which changes the computation of the weight trend and calorie balance information displayed below the monthly chart in the Log page. Trend computation for charts in the application generally works on a “what you see is what you get” philosophy—a linear trend is fit to the data plotted in the chart, whatever time period it covers. While this makes sense for historical log charts and long term charts, it can lead to confusing and potentially misleading trend reports as daily entries are added to the current month's chart. At the start of the month, only a few data points are plotted, so small changes in weight and trend can lead to large changes in the slope fit to the trend. As the month progresses and more and more entries are made in the log, the slope is computed from an ever-increasing number of trend points, so the trend reported grows from a trend based on only a few days to the trend for an entire month as the last day's weight is entered in the log.

With the change just implemented, the trend analysis for the most recent monthly log in the database (which will be the current month's log for users actively recording their weight) will be based on the last seven days' trend values, including those from the previous month's log when less than a week's weights are present in the current log. This eliminates the instability in the trend analysis at the start of a month and causes the trend analysis reported in the current monthly log page to consistently be based on the last week and consequently agree with the “Last Week” analysis in the Trend page. The trend analysis shown in logs for previous months is unchanged and will continue to reflect all of the data in the chart for the month.

In an unrelated change, it was possible for a monthly log with sparse entries to create a situation where the trend analysis would divide by zero trying to fit the trend and consequently return an incomplete log page. This is now fixed: if insufficient data are present to define a linear trend, the weight gain/loss trend and calorie balance will be reported as zero.

As of today, there are now a total of 7,779 Hacker's Diet Online accounts open, of which 1,379 are active (defined as having made a weight entry in the last 30 days). Of the active accounts, 516, or 37%, permit public viewing of their results under a pseudonym. A total of 225 accounts have Web badge generation enabled, permitting users to display automatically updated status of their progress on a Web page. A total of 54% of active accounts have made a weight log entry within the last three days and fully one third within the last 24 hours.

Posted at March 8, 2009 14:18