Classifying the activity as a function of time

81 views
Skip to first unread message

chris...@project-sapiens.com

unread,
Aug 15, 2018, 1:05:28 PM8/15/18
to R package GGIR
Hi All,

I am looking to get an activity classification (asleep, awake, active period longer than 10, vigorous activity with active period) as a function of time.
This is classification is plotted in the Summary Report, but i'm looking to extract this activity-state paired with time. (or begin-end time of all sections) 

I output the file meta/ms5.outraw/NA_30_100_400raw.csv and it has a class_id between 0-15, but I can't seem to find to what the values 0 to15 correspond, so not sure that's going down the right path. 

Is there another file I should write to disk (I would prefer a csv as i'll be using python to analyse the results)

Thanks for your help. 

Screenshot 2018-08-15 17.46.32.png

Vincent van Hees

unread,
Aug 19, 2018, 11:36:43 AM8/19/18
to Christopher Bonnett, R package GGIR
Hi Christopher,
You are on the right path. The exported files are what you need, but I seem to have forgotten to document what those levels refer to.
I have now created an issue for it: https://github.com/wadpac/GGIR/issues/107
For the time being:

0 = Sleep period time + sleep
1 = Sleep period time + wakefulness (minimal movement)
2 = Sleep period time + wakefulness + light activity
3 = Sleep period time + wakefulness + moderate activity
4 = Sleep period time + wakefulness + vigorous activity
5 = Daytime + sustained inactivity
6 = Daytime + other inactivity
7 = Daytime + light activity
8 = Daytime + moderate activity
9 = Daytime + vigorous activity
If you use three bout duration for MVPA, inactive, and light bouts then levels 10 to 18 will look as follows:
10 = Daytime + MVPA bout, long length (whichever length you specified)
11 = Daytime + MVPA bout, medium length (whichever length you specified)
12 = Daytime + MVPA bout, short length (whichever length you specified)
13 = Daytime + Inactivity bout, long length (whichever length you specified)
14 = Daytime + Inactivity bout, medium length (whichever length you specified)
15 = Daytime + Inactivity bout, short length (whichever length you specified)
16 = Daytime + Light activity bout, long length (whichever length you specified)
17 = Daytime + Light activity bout, medium length (whichever length you specified)
18 = Daytime + Light activity bout, short length (whichever length you specified)

As you see the number of bout levels depends on the number of bout durations you choose in the part5.
I suppose it would be good if the meaning of all these levels is reflected in the column name.

Thanks for raising this gap in the documentation, Vincent


--
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/1e8b75ae-d4ef-48c4-be4e-6fc0b68e1f85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

chris...@project-sapiens.com

unread,
Sep 7, 2018, 9:06:12 AM9/7/18
to R package GGIR
Hi Vincent,

Thanks you providing reference to the numbers, that is indeed what I needed. 


It seems that the activity classification does not have a 'not worn' class.  I have several examples where the tracker was clearly not worm and the data quality check graphs conforms this. But in the activity classification timeline it shows activity bouts, sleep etc. 
What would I need to do add a 'not worn' class to the timeline ? 

Regards,

Christopher 


Screenshot 2018-09-07 13.55.53.png



Screenshot 2018-09-07 14.03.32.png

Screenshot 2018-09-07 13.55.53.png

Vincent van Hees

unread,
Sep 23, 2018, 12:50:42 PM9/23/18
to Christopher Bonnett, R package GGIR
Hi Christopher,

Good point - this would indeed be a useful enhancement to the reports.

Part 2 produces milestone data (stored as RData file) that includes a time series of when non-wear was detected. See documentation for 'rout' in the GGIR manual, by default at 15 minute resolution. 
At line 139 of g.part5 you can see how I currently use this information to only report the total amount of non-wear.

A possible new feature could be to also use the non-wear time in the reports and exported data, e.g. by defining it as a separate category or by leaving the values blank.

You or anyone else interested in this are welcome to work on this software feature and to make a pull request in the GGIR GitHub repository, which I will then merge in addition to making you a package contributor.

If this is too complicated, then I am happy to do this as a paid consultancy as described here: https://www.movementdata.nl/how-to-help-sustain-ggir.

Thanks, Vincent

Anna Pulakka

unread,
Nov 13, 2018, 5:32:18 AM11/13/18
to R package GGIR

Dear Vincent and Christopher,

 

thank you for this useful discussion that has really helped me to figure out how to do the same that Christopher is seeking to do: get activity classification as a function of time. (And, thank you, Vincent, for creating the GGIR analysis in the first place!)

 

To make sure I'm doing things correctly, I compared the daily activity derived from the files in the ms5.outraw folder to those in the "part5_daysummary_WW_L30M100.6V428.8_T5A5.csv" file in the Results folder and noticed that there are some differences. Generally, there are some more sedentary time and less time in LPA and MVPA when derived from the csv files in the ms5.outraw folder compared to the results file. The differences are sometimes only a couple of minutes but can be up to 20-30 min/day. Usually the differences add up to zero, so the duration of the day is the same. Would you have any idea where these differences come from?

 

Below I try to explain how I made the comparison, maybe there's something that I'm not doing correctly:

 

In part 5, I'm only using one bout duration to make things simpler:

             #-------------------------------
             # Part 5:
             # Key functions: Merging physical activity with sleep analyses
             #-------------------------------
             threshold.lig = c(30), threshold.mod = c(100.6),  threshold.vig = c(428.8),
             boutcriter = 0.8,      boutcriter.in = 0.9,     boutcriter.lig = 0.8,
             boutcriter.mvpa = 0.8, boutdur.in = c(1), boutdur.lig = c(1),
             boutdur.mvpa = c(1),   timewindow = c("WW"),

 

This gives me class_id between 0-12 which I assume mean:

0 = Sleep period time + sleep

1 = Sleep period time + wakefulness (minimal movement)

2 = Sleep period time + wakefulness + light activity

3 = Sleep period time + wakefulness + moderate activity

4 = Sleep period time + wakefulness + vigorous activity

5 = Daytime + sustained inactivity

6 = Daytime + other inactivity

7 = Daytime + light activity

8 = Daytime + moderate activity

9 = Daytime + vigorous activity

10 = Daytime + MVPA bout, 1 min length

11 = Daytime + Inactivity bout, 1 min length

12 = Daytime + Light activity bout, 1 min length

 

To compare sedentary time, I compare (5+6+11)/12 (to change 5s epochs into 1 minute time) to dur_TINday_min in the results file.

LPA: (7+12)/12 to dur_TLIGday_min in the results file.

MVPA: (8+9+10)/12 to dur_TMODday_min+dur_TVIGday_min in the results file

Duration of the day: minutes in SED + LPA + MVPA compared to dur_day_min in results (these are usually the same, which I guess means that I'm defining the days correctly)


Best regards and thank you again!

Anna

Reply all
Reply to author
Forward
0 new messages