Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scaling in apply_sadeh.R #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joshuamirth
Copy link

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".

Fixed scaling in apply_sadeh.
@dipetkov
Copy link
Owner

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
Copy link
Owner

dipetkov commented Mar 12, 2022

For what is worth, the "divide by 100" adjustment is applied to before the apply_cole_kripke algorithm, not the apply_sadeh algorithm.

actigraph_adjustment <- function(data) {
data %>%
mutate(
count = pmin(.data$axis1 / 100, 300)
)
}

@joshuamirth
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants