actigraph.sleepr icon indicating copy to clipboard operation
actigraph.sleepr copied to clipboard

Fix scaling in apply_sadeh.R

Open joshuamirth opened this issue 2 years ago • 3 comments

Actigraph counts need to be scaled by 100 before scoring with Sadeh (the same as in Cole-Kripke). See the Actigraph user manual: "He [Sadeh] used the same device that Cole-Kripke used to develop their algorithm, and ActiGraph therefore adapted it in the same way by scaling our data".

joshuamirth avatar Mar 10 '22 16:03 joshuamirth

Thank you for your contribution.

Have you run tests on actual data or are these corrections based on the descriptions in the Sadeh paper and the ActiLife manual?

At the time I implemented the algorithms I had access to large collection of (private) data as well as the ActiLife software, so I ran lots of tests to make sure I got the same results.

dipetkov avatar Mar 12 '22 18:03 dipetkov

For what is worth, the "divide by 100" adjustment is applied to before the apply_cole_kripke algorithm, not the apply_sadeh algorithm. https://github.com/dipetkov/actigraph.sleepr/blob/27a8bdfa1a808bfae6b82f1a2c8839e076412000/R/apply_cole_kripke.R#L120-L125

dipetkov avatar Mar 12 '22 19:03 dipetkov

Based on actual data. Counts/epoch is typically in the 10-30,000 range, so thresholding without first scaling sets (essentially) all counts to 300 and the Sadeh algorithm then produces nonsensical results. This same data is scored successfully by the Cole-Kripke algorithm as you've implemented it.

I don't have access to the ActiLife software to compare, but scaling by 100 produces closer agreement with the ground truth.

joshuamirth avatar Mar 14 '22 15:03 joshuamirth