Skip to content

Commit

Permalink
re-insert option to control HDCZA internal thresholds, but let them d…
Browse files Browse the repository at this point in the history
…efault to the thresholds used in the paper.
  • Loading branch information
vincentvanhees committed Jun 28, 2024
1 parent 4235e99 commit 24794b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions R/HASPT.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HASPT = function(angle, sptblocksize = 30, spt_max_gap = 60, ws3 = 5,
HASPT.algo="HDCZA", HDCZA_threshold = 0.2, invalid,
HASPT.algo="HDCZA", HDCZA_threshold = c(), invalid,
HASPT.ignore.invalid=FALSE, activity = NULL) {
tib.threshold = SPTE_start = SPTE_end = part3_guider = c()
# internal functions ---------
Expand All @@ -25,7 +25,10 @@ HASPT = function(angle, sptblocksize = 30, spt_max_gap = 60, ws3 = 5,

x = zoo::rollapply(angle, width = k1, FUN = medabsdi, fill = 0) # 5 minute rolling median of the absolute difference
if (is.null(HDCZA_threshold)) {
threshold = quantile(x, probs = 0.1) * 15
HDCZA_threshold = c(10, 15)
}
if (length(HDCZA_threshold) == 2) {
threshold = quantile(x, probs = HDCZA_threshold[1] / 100) * HDCZA_threshold[2]
if (threshold < 0.13) {
threshold = 0.13
} else if (threshold > 0.50) {
Expand Down
4 changes: 3 additions & 1 deletion man/GGIR.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,9 @@ GGIR(mode = 1:5,
et al. 2018 Scientific Report (doi: 10.1038/s41598-018-31266-z). However,
doing so has not been supported by research yet and is only intended to
facilitate methodological research, so we advise sticking with the default in
line with the publication.
line with the publication. Further, if HDCZA_threshold is set to a numeric vector of
length 2, e.g. c(10, 15), that will be used as percentile and
multiplier for the above mentioned 6th step.
}
\item{HASPT.ignore.invalid}{
Expand Down

0 comments on commit 24794b7

Please sign in to comment.