Valid days differ between part 2 output and part 5 output

182 views
Skip to first unread message

Kiya Hurley

unread,
Nov 9, 2017, 6:59:19 AM11/9/17
to R package GGIR
Dear all, 

I am a little confused about why a difference occurs in the number of valid days between the two outputs for part2 and part 5. 

In the file named 'part2_summary', the children seemed to provide 6 valid days of wear (4 wkdays and 2 wedays), however when I look at the combined sleep and activity data in 'part5_personsummary...' the number of valid days drops to 2 wddays only. Below is my code, I'm wondering if I have something set incorrectly so it's causing 4 valid days of data to drop out? 

I am also getting the following error in the output from my cluster: 

"Generate visual reports
[1] "File 0104010401__028647_2015-09-28 15-08-25.bin"
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' and 'y' lengths differ
Calls: g.shell.GGIR -> g.plot5 -> plot -> plot.default -> xy.coords
Execution halted" 

I do not necessarily need the visual reports, although they are interesting to look at, but would like to understand why I'm getting this error. 

The children did not complete a sleep log. 

Many thanks in advance, 

Kind regards, 

Kiya




mode=c(2,3,4,5)
 datadir= "/gpfs/bb/kellehek/0104"
 outputdir= "/gpfs/bb/kellehek/0104"
 studyname="CD_0104"
 f0=1 
 f1=c()
g.shell.GGIR(#-------------------------------
            # General parameters
            #-------------------------------
  mode=mode, 
  datadir=datadir, 
  outputdir=outputdir, 
  studyname=studyname, 
  f0=f0, 
  f1=f1, 
  overwrite=TRUE, 
  do.imp=TRUE,
  idloc=1, 
  print.filename=TRUE,
  storefolderstructure=FALSE,

 #-------------------------------
 # Part 2:
 #-------------------------------
 strategy = 1,               
 ndayswindow = 7,
 hrs.del.start = 1,          
 hrs.del.end = 1,
 maxdur = 9,                 
 includedaycrit = 10,
 qwindow = c(0,24),
 ilevels = c(0, 23.5, 359.7, 695.8, 10000),
 mvpathreshold = c(359.7),
 #-------------------------------
 # Part 3:
 #-------------------------------
 # Key functions: Sleep detection
 timethreshold= c(5),        
 anglethreshold=5,
 acc.metric="ENMO",
 desiredtz="Europe/London",
 ignorenonwear = TRUE,
 #-------------------------------
 # Part 4:
 #-------------------------------
 # Key functions: Integrating sleep log (if available) with sleep detection
 # storing day and person specific summaries of sleep
 do.visual = TRUE,
 outliers.only = FALSE,
 excludefirstlast = FALSE,
 criterror = 8,
 includenightcrit = 4,
 relyonsleeplog = FALSE,
 def.noc.sleep = c(), 
 #-------------------------------
 # Part 5:
 # Key functions: Merging physical activity with sleep analyses
 #-------------------------------
 threshold.lig = c(23.5), 
 threshold.mod = c(359.7),  
 threshold.vig = c(695.8),
 timewindow = c("WW"),
 #-----------------------------------
 # Report generation
 #-------------------------------
 # Key functions: Generating reports based on meta-data
 do.report=c(2,4,5), 
 visualreport = TRUE,  
 dofirstpage = TRUE,
 viewingwindow = 1)

Juliana Exel

unread,
Apr 5, 2018, 5:20:26 AM4/5/18
to R package GGIR
Hi, Kiya.

 Did you find what was the problem in your case?

I am facing something similar here.

Does anyone have a hint?

Jairo Hidalgo Migueles

unread,
Apr 5, 2018, 11:04:35 AM4/5/18
to R package GGIR
Hi Kiya,

Can you try to set the excludefirstlast argument in part4 as TRUE? I got coherent data doing that, let us know if this solved your question.

Best,
Jairo

Vincent van Hees

unread,
Apr 5, 2018, 4:07:03 PM4/5/18
to Jairo Hidalgo Migueles, R package GGIR
Hi Kiya, Juliana and Jairo,
Part 2 and 4 use all blocks of 24 hours in a measurement (midnight to
midnight or noon to noon respectively), while GGIR part 5 requires
time blocks from waking up in the morning till waking up the next day
and only if the monitor is worn enough during both the day and the
night.
As a result you typically lose most of the first 24 hours because the
measurement often starts after waking up, and because the last night
is also skipped in part 5 you also loose around 24 hours at the end.
This explains why output for part 5 typically has less days.
I looked at this critically when I developed it, but it could still be
worth looking at it again to see whether there is a way to maybe
extract partial information about the first and last days of the
measurement.
Vincent

On 5 April 2018 at 17:04, Jairo Hidalgo Migueles
> --
> You received this message because you are subscribed to the Google Groups "R
> package GGIR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to RpackageGGIR...@googlegroups.com.
> To post to this group, send email to Rpacka...@googlegroups.com.
> Visit this group at https://groups.google.com/group/RpackageGGIR.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/RpackageGGIR/f4c34903-a0ca-43c3-9cf1-b8ef4048d8be%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Juliana Exel

unread,
Apr 6, 2018, 6:11:55 AM4/6/18
to R package GGIR
Thank you so much for the reply, Jairo and Vincent.

I wonder if there is more than the exclusion of first and last days of measurements around this issue. I say that because of my data, where I have 8 days with valid data in part 2 and only 5 days processed in part 3.


Here's the code:



library(GGIR)
g.shell.GGIR(#=======================================
             # INPUT NEEDED:
             mode=c(1,2,3,4,5),
             datadir= "C:/Users/Convidado/Documents/ActiGraph/GGIR_/csv",
             outputdir= "C:/Users/Convidado/Documents/ActiGraph/GGIR_/results",
             f0=2, f1=2,
             #-------------------------------
             # Part 1:
             #-------------------------------
             # Key functions: reading file, auto-calibration, and extracting features
             do.enmo = TRUE,             do.anglez=TRUE,
             chunksize=1,                printsummary=TRUE,
             #-------------------------------
             # Part 2:
             #-------------------------------
             strategy = 1,               ndayswindow=9,
             hrs.del.start = 0,          hrs.del.end = 0,
             maxdur = 0,                 includedaycrit = 1,
             winhr = c(5,10),
             qlevels = c(c(1380/1440),c(1410/1440)),
             qwindow=c(0,24),
             ilevels = c(seq(0,400,by=50),8000),
             mvpathreshold =c(100,120),
             bout.metric = 4,
             closedbout=FALSE,
             #-------------------------------
             # Part 3:
             #-------------------------------
             #Key functions: Sleep detection
             timethreshold= c(5),        anglethreshold=5,
             ignorenonwear = TRUE,
             #-------------------------------
             # Part 4:
             #-------------------------------
             # Key functions: Integrating sleep log (if available) with sleep detection
             # storing day and person specific summaries of sleep
             excludefirstlast = TRUE,
             includenightcrit = 0,
             def.noc.sleep = c(1),
             #loglocation= "C:/Users/Convidado/Documents/ActiGraph/GGIR_Runners/sleep/testsleeplogfile.csv",
             outliers.only = TRUE,
             criterror = 4,
             relyonsleeplog = FALSE,
             sleeplogidnum = TRUE,
             #colid=1,
             #coln1=2,
             do.visual = FALSE,
             nnights = 9,
             #-------------------------------
             # Part 5:
             # Key functions: Merging physical activity with sleep analyses
             #-------------------------------
             threshold.lig = c(30), threshold.mod = c(100),  threshold.vig = c(400),
             boutcriter = 0.8,      boutcriter.in = 0.9,     boutcriter.lig = 0.8,
             boutcriter.mvpa = 0.8, boutdur.in = c(1,10,30), boutdur.lig = c(1,10),
             boutdur.mvpa = c(1),   timewindow = c("WW"),
             #-----------------------------------
             # Report generation
             #-------------------------------
             # Key functions: Generating reports based on meta-data
             do.report=c(1,2,3,4,5),
             visualreport=FALSE,     dofirstpage = FALSE,
             viewingwindow=1)



And here are the files:
part2_daysummary.csv
part5_daysummary_WW_L30M100V400_T5A5.csv

Vincent van Hees

unread,
Apr 16, 2018, 4:03:23 PM4/16/18
to R package GGIR
Hi Juliana,
It is not only the first and last day that are ignored in part5. I designed part5 to only include full windows lasting from waking up to waking up, and to never consider the last day, the before last day after waking up, and the first day of measurement.
I did this because I was not sure whether 'waking up' could reliably be detected on the first and last day, if people only start wearing the accelerometer on the second day when they wake up or and take it off in the last evening then this is true.

Thanks to work by Jairo, we may be able to give you the option to extract results from more days in the next release of GGIR.
Best wishes, Vincent

Juliana Exel

unread,
Apr 17, 2018, 6:08:02 AM4/17/18
to R package GGIR
I'm looking forward the next release!!!
Awesome job, guys.

Thanks for the reply Vincent and Jairo.

My best,

Juliana.

Libby Rearick

unread,
Nov 29, 2018, 10:28:48 AM11/29/18
to R package GGIR
Hi Vincent
Can you please tell me if the new release has adjustments to include more valid days in part 5?
Thanks!

Vincent van Hees

unread,
Nov 29, 2018, 10:32:41 AM11/29/18
to Libby Rearick, R package GGIR
Yes - this should be fixed as of version 1.6-7 (released in September).
If not, then please let us know.
Vincent

Reply all
Reply to author
Forward
0 new messages