junruidi / actfrag Goto Github PK
View Code? Open in Web Editor NEWActivity Fragmentation Metrics Extracted From Minute Level Activity Data
Activity Fragmentation Metrics Extracted From Minute Level Activity Data
Hi Junrui, I am finally able to get started with making your work available via GGIR.
In https://github.com/junruidi/ActFrag/blob/master/R/fragmentation.R
should the following documentation for Gini index
#' \item{Gini_r}{Gini index for active bout}
#' \item{Gini_a}{Gini index for sedentary bout}
be replaced by
#' \item{Gini_r}{Gini index for sedentary bout}
#' \item{Gini_a}{Gini index for active bout}
in that way it will be consistent with the naming of the other variables, where 'a' refers to active and 'r' to sedentary? or does the naming intentionally flip direction for the Gini index?
I have data where I have non-wear periods that are not at the end of the recording time.
I have elected to pre-screen the counts vector, and place NA values in the counts variable x
where there is non-wear. Your function does not provide the same output as if there were 0s for NA values. I've compared running your function with NA's (row 2) vs. 0's (row 1) using the reproducible code below. I also tried pre-filtering my data for wear time before providing it to your function (row 3). These three methods produce different results. Which one is theoretically correct? Given your answer, I would recommend editing the function to make at least rows 1 and 2 consistent.
# simulate data
x <- c(sample(0:2, 600, prob = c(.75,.2,.05), replace = T),
rep(0,200),
sample(0:2, 200, prob = c(.75,.2,.05), replace = T)) %>%
as.integer
wear <- c(rep(1,600), rep(0,200), rep(1,200))
x.NA <- x
x.NA[wear == 0] <- NA
# fragmentation metrics
bind_rows(
fragmentation(x, wear, thresh = 1, metrics = "all") %>% as.tibble,
fragmentation(x.NA, wear, thresh = 1, metrics = "all") %>% as.tibble,
fragmentation(x.NA[wear == 1], w = rep(1,800), thresh = 1, metrics = "all") %>% as.tibble
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.