Updated MAG computation in the presence of large missing data#186
Closed
neokok wants to merge 2 commits intoirinagain:masterfrom
Closed
Updated MAG computation in the presence of large missing data#186neokok wants to merge 2 commits intoirinagain:masterfrom
neokok wants to merge 2 commits intoirinagain:masterfrom
Conversation
irinagain
requested changes
Jun 17, 2025
Owner
irinagain
left a comment
There was a problem hiding this comment.
see commens here and on slack
| #' the sum of the absolute change in glucose. The sum is then divided by \eqn{\Delta t}, | ||
| #' the total number of n-minute intervals (default n = 60 for hourly change). | ||
| #' | ||
| #' @author Elizabeth Chun |
Owner
There was a problem hiding this comment.
Also double-check that we indeed agreed that n=60 is the right default
| mag = sum(abs(diff(idx_gl)), na.rm = TRUE)/ | ||
| (length(na.omit(idx_gl))*n/60) | ||
| diffs = diff(as.vector(t(data_ip[[1]]))) | ||
| total_time = (length(na.omit(diffs))*dt0)/n |
Owner
There was a problem hiding this comment.
if total_time is in hours, then n should always be 60. if n is less than 60, then I am not sure the logic is appropriate. The original code was specifically taking differences over an interval controlled by n. THe new code will always take consecutive differences so this control is eliminated. Better to stick to the original code, but modify for NA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.