statist7 / LMSgrowth2

MIT License
2 stars 2 forks source link

Fix presentation of single date measurements #37

Closed tamuri closed 4 years ago

tamuri commented 4 years ago

handle switching between growth charts.

This PR adds formattable package, so you need to packrat::restore() before running.

tamuri commented 4 years ago

Screenshot:

Screenshot_2019-11-22 LMSgrowth2

giordano commented 4 years ago

A couple of quick comments:

  1. by inserting almost random numbers, I noticed that if a measurement is very far from the average (probably more than 5 SDSs), we don't get a centile number but the z-score, so in the plot we can't see the measurement:

    image

  2. would it make sense to always make sure that height = sitting height + leg length? As it is now, a change in height updates leg length, a change in sitting height updates leg lengths, a change in leg length doesn't affect anything. Having three measurements involved makes it very tricky to keep them consistent.

tamuri commented 4 years ago

by inserting almost random numbers, I noticed that if a measurement is very far from the average (probably more than 5 SDSs), we don't get a centile number but the z-score, so in the plot we can't see the measurement.

Yes, maybe we can set all SDS > 3.3 to 99.9 centile, for plotting purposes. @statist7?

would it make sense to always make sure that height = sitting height + leg length? As it is now, a change in height updates leg length, a change in sitting height updates leg lengths, a change in leg length doesn't affect anything. Having three measurements involved makes it very tricky to keep them consistent.

Agreed, it's too complicated to do anything sensible. Let's keep the current calculations and revisit if we get a good idea.

statist7 commented 4 years ago

The tab looks really good.

Yes, maybe we can set all SDS > 3.3 to 99.9 centile, for plotting purposes. @statist7?

The centile scale distorts reality with its 0-100 scale, and values in the tails all get crammed together. It might be better plotting them on the underlying z-score scale, so you use the existing centile numbers (a nice touch) but plot them at the corresponding z-score values. In this way extreme values can be seen spread out rather than crammed up against 0 or 100. The scale would need to use z-score labels beyond the 0.1th and 99.9th centiles, as z2cent provides.

The scale should also probably automatically expand to handle outliers, within reason.

Another alternative would be to have three plot options: centile, z-score and centile on z-score (i.e. what I've just described). The advantage of the current centile scale is that it will (or should) plot everything, even extreme outliers, as they will be close to 0 or 100. In fact I think it currently omits extremely low outliers, which it shouldn't. Conversely high outliers appear as a fraction of a blob.

would it make sense to always make sure that height = sitting height + leg length?

This is indeed tricky. Entering height then leg length inserts sitting height, but updating sitting height then does nothing. When this happens it might be worth adding a flag next to leg length to show it is out of sync, assuming that height is always taken as correct. Perhaps change it to italic font?

Note that playing around this way generates a warning in renderPlotly.

The age input is very flexible - I see it takes a decimal age quite happily, which is useful.

tamuri commented 4 years ago

Hi @giordano, this is ready to review. I've made all the changes and the few others we discussed (e.g. dynamically setting the range of the plot to accomodate extreme values)