Giter VIP home page Giter VIP logo

actfrag's People

Contributors

junruidi avatar muschellij2 avatar

Watchers

 avatar  avatar

actfrag's Issues

Gini documentation

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?

`fragmentation` doesn't handle NA values in `x` properly.

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
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.