ENMO_fullRecordingMean, ACC_nightandday_mg_wei - matching day summaries with person summary outputs

107 views
Skip to first unread message

dominika

unread,
Dec 29, 2019, 2:27:03 PM12/29/19
to R package GGIR

Hi Everyone,

 

I am new to the GGIR package and while running some preliminary data reduction on a subsample, I have a few queries related to calculation of ENMO_fullRecordingMean (part 2 summary) and ACC_nightandday_mg_wei (part 5 summary) summary metrics.

 

Specifically, I would like to understand the nuance in calculating both metrics and how they relate to the data reported in the day summaries for parts 2 and 5.

 

In Vincent van Hees’s response to Stuart Gray’s query (05/10/2019) about the difference between ENMO_fullRecordingMean and ACC_nightandday_mg_wei, Vincent explained that ENMO_fullRecordingMean is “the average day using all available data in the recording minus invalid data (monitor not worn) by first taking the average per time section of the day and then the average of those averages.” In contrast, ACC_nightandday_mg_wei (the weighted average of daily averages) accounts for invalid (imputed) data.

 

However, in the GGIR documentation (12/04/2019, p. 14), it is stated that ENMO_fullRecordingMean is “the average ENMO over all the available data normalised per 24-hour cycles (diurnal balanced), with invalid data imputed by the average at similar time points on different days of the week.” As I understand Vincent’s response to Stuart, this description is closer to the ACC_nightandday_mg_wei than to ENMO_fullRecordingMean. Thus, I wonder whether ENMO_fullRecordingMean includes or excludes the non-wear time. If someone was able to clarify this, I would appreciate it!

 

Relatedly, what is the difference between ENMO_fullRecordingMean and AD_mean_ENMO_mg_0-24hr? It seems from comparing the two metrics that the former may be calculated over all available days while the latter is based on valid days only (please see the attached .xlsx file for comparison). Is this correct?

 

When computing ACC_nightandday_mg_wei based on part 5 day summaries, my numbers don’t seem to match with the part 5 summary output (please see the GGIR_Q1.xlsx file for an example of 3 subjects). Likewise, when computing plain average based on day summary data, my numbers do not add up to the ACC_nightandday_mg_pla. Thus, I am wondering what I may be missing in my calculations based on the day summary output to match the averages provided in part 5 summary. If anyone has had a similar issue, I would appreciate any feedback.

 

My last question is related to whether the data from valid days only are accounted for in the computation of both metrics if a valid day criterion is specified (day summary outputs suggest that this is the case)? I am defining a valid day as one with at least 16 hours of valid wear time using includedaycrit = 16 argument. If this is the case, then the difference between two summary metrics would be that ENMO_fullRecordingMean excludes the periods of non-wear during valid days, while the non-wear periods within valid days only are accounted for (by imputation) in ACC_nightandday_mg_wei. Is this correct?

 

Please see my code below.

 

Thank you very much in advance for your help!

 

Best,

 

Dominika


#=====================

               # Part 2

               #=====================

               strategy = 1,

               #doiglevels = TRUE,

               hrs.del.start = 0,      hrs.del.end = 0,

               maxdur = 7,             includedaycrit = 16,

               #qlevels = c(c(1380/1440),c(1410/1440),c(1438/1440)),

               qwindow=c(0,6, 8.5, 15.5, 18.5),

               ilevels = c(seq(0,400,by=50),8000),

               iglevels = c(seq(0,4000,by=25),8000),

               mvpathreshold =c(201),

               bout.metric = 4,

               excludefirstlast = FALSE,

               includenightcrit = 16,

               #=====================

               # Part 3 + 4

               #=====================

               def.noc.sleep = 1,

               outliers.only = TRUE,

               criterror = 4,

               do.visual = TRUE,

               #=====================

               # Part 5

               #=====================

               threshold.lig = c(50), threshold.mod = c(201),  threshold.vig = c(707),

               boutcriter = 0.8,      boutcriter.in = 0.9,     boutcriter.lig = 0.8,1.0,

               boutcriter.mvpa = 0.8, boutcriter.vig = 0.8,    boutdur.in = c(1,10,20,30), boutdur.lig = c(1,10),

               boutdur.mvpa = c(1,5,10),

               #=====================

               # Visual report

               #=====================

               timewindow = c("WW"),

               visualreport=TRUE)


GGIR_Q1_ENMO.xlsx

Vincent van Hees

unread,
Jan 5, 2020, 5:05:45 AM1/5/20
to dominika, R package GGIR
Hi Dominika,
See my responses below:

On Sun, 29 Dec 2019 at 20:27, dominika <psd...@gmail.com> wrote:

Hi Everyone,

 

I am new to the GGIR package and while running some preliminary data reduction on a subsample, I have a few queries related to calculation of ENMO_fullRecordingMean (part 2 summary) and ACC_nightandday_mg_wei (part 5 summary) summary metrics.

 

Specifically, I would like to understand the nuance in calculating both metrics and how they relate to the data reported in the day summaries for parts 2 and 5.

 

In Vincent van Hees’s response to Stuart Gray’s query (05/10/2019) about the difference between ENMO_fullRecordingMean and ACC_nightandday_mg_wei, Vincent explained that ENMO_fullRecordingMean is “the average day using all available data in the recording minus invalid data (monitor not worn) by first taking the average per time section of the day and then the average of those averages.” In contrast, ACC_nightandday_mg_wei (the weighted average of daily averages) accounts for invalid (imputed) data.

 

However, in the GGIR documentation (12/04/2019, p. 14), it is stated that ENMO_fullRecordingMean is “the average ENMO over all the available data normalised per 24-hour cycles (diurnal balanced), with invalid data imputed by the average at similar time points on different days of the week.” As I understand Vincent’s response to Stuart, this description is closer to the ACC_nightandday_mg_wei than to ENMO_fullRecordingMean. Thus, I wonder whether ENMO_fullRecordingMean includes or excludes the non-wear time. If someone was able to clarify this, I would appreciate it!

 

>> Both explanations refer to the same calculation. The "average day" in my response to Stuart and "normalised 24-hour cycle" in the documentation are the same thing. Variables ending with "_fullRecordingMean" are not based on the zero acceleration values related to non-wear time, but are based on the imputed value for those non-wear periods. The imputation is done with the average value of similar time points in the measurement where the accelerometer was worn. So, the non-wear time points are included, but not their original values, because the values are imputed.

Relatedly, what is the difference between ENMO_fullRecordingMean and AD_mean_ENMO_mg_0-24hr? It seems from comparing the two metrics that the former may be calculated over all available days while the latter is based on valid days only (please see the attached .xlsx file for comparison). Is this correct?


>> Variables ending with " fullRecordingMean" are only calculated per recording and use any time segments it finds that is considered valid (monitor worn), even if a day has only one hour of valid data. Variables "_0-24hr" (where 0 and 24, can be any other number) on the other hand are first calculated per day including non-wear imputation. Next, you can set a minimum required number of hours, e.g. 16 by default. Next, the person level aggregates represent the mean or weighted mean of those day-level estimates. This means that for the "fullRecording" variables we use as much data as possible, while for the "0-24" variables we only use data from days with a minimum number of valid hours.

 

When computing ACC_nightandday_mg_wei based on part 5 day summaries, my numbers don’t seem to match with the part 5 summary output (please see the GGIR_Q1.xlsx file for an example of 3 subjects). Likewise, when computing plain average based on day summary data, my numbers do not add up to the ACC_nightandday_mg_pla. Thus, I am wondering what I may be missing in my calculations based on the day summary output to match the averages provided in part 5 summary. If anyone has had a similar issue, I would appreciate any feedback.


>> part2_summary is calculated with part2_daysummary, and part5_personsummary is calculated with part5_daysummary. What defines a valid day may differ between part 2 and 5, because they use different criteria for a valid day and in the case of WW daydefinition even a different time window. Please make sure you use the part 2 and part5 specific definition of valid days. It is not clear from your spreadsheet what information you used to define a (in)valid days.

My last question is related to whether the data from valid days only are accounted for in the computation of both metrics if a valid day criterion is specified (day summary outputs suggest that this is the case)? I am defining a valid day as one with at least 16 hours of valid wear time using includedaycrit = 16 argument. If this is the case, then the difference between two summary metrics would be that ENMO_fullRecordingMean excludes the periods of non-wear during valid days, while the non-wear periods within valid days only are accounted for (by imputation) in ACC_nightandday_mg_wei. Is this correct?


>> Hopefully my response above answers this. Note that "wei" indicates that day estimates are aggregated to person estimates by weighting weekend and weekdays proportionally, this has nothing to do with how non-wear is treated.
--
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 view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/b87efe0d-9379-43fe-a5de-31f1de170f6e%40googlegroups.com.

dominika

unread,
Jan 6, 2020, 1:43:41 PM1/6/20
to R package GGIR

Hi Vincent,

 

Thank you for taking the time to respond! Your responses clarified nicely the differences between ENMO_fulLRecordingMean, ACC_nightandday_mg_wei and AD_mean_ENMO_mg_0-24hr.

 

However, I think that there was some confusion in my query related to comparing the outputs from day and person summaries. I still have a question as my day summary data does not seem to match person summary for the same part (part 5). Please see below for details, an attached spreadsheet and updated code.

 

 

Thank you,

 

Dominika

 


On Sunday, January 5, 2020 at 4:05:45 AM UTC-6, Vincent van Hees wrote:
Hi Dominika,
See my responses below:

On Sun, 29 Dec 2019 at 20:27, dominika <psd...@gmail.com> wrote:

Hi Everyone,

 

I am new to the GGIR package and while running some preliminary data reduction on a subsample, I have a few queries related to calculation of ENMO_fullRecordingMean (part 2 summary) and ACC_nightandday_mg_wei (part 5 summary) summary metrics.

 

Specifically, I would like to understand the nuance in calculating both metrics and how they relate to the data reported in the day summaries for parts 2 and 5.

 

In Vincent van Hees’s response to Stuart Gray’s query (05/10/2019) about the difference between ENMO_fullRecordingMean and ACC_nightandday_mg_wei, Vincent explained that ENMO_fullRecordingMean is “the average day using all available data in the recording minus invalid data (monitor not worn) by first taking the average per time section of the day and then the average of those averages.” In contrast, ACC_nightandday_mg_wei (the weighted average of daily averages) accounts for invalid (imputed) data.

 

However, in the GGIR documentation (12/04/2019, p. 14), it is stated that ENMO_fullRecordingMean is “the average ENMO over all the available data normalised per 24-hour cycles (diurnal balanced), with invalid data imputed by the average at similar time points on different days of the week.” As I understand Vincent’s response to Stuart, this description is closer to the ACC_nightandday_mg_wei than to ENMO_fullRecordingMean. Thus, I wonder whether ENMO_fullRecordingMean includes or excludes the non-wear time. If someone was able to clarify this, I would appreciate it!

 

>> Both explanations refer to the same calculation. The "average day" in my response to Stuart and "normalised 24-hour cycle" in the documentation are the same thing.

 Thank you for clarifying. 

Variables ending with "_fullRecordingMean" are not based on the zero acceleration values related to non-wear time, but are based on the imputed value for those non-wear periods. 
The imputation is done with the average value of similar time points in the measurement where the accelerometer was worn. So, the non-wear time points are included, but not their original values, because the values are imputed.


This was the main point of confusion for me. Thank you for clarifying that “_fullRecordingMean” includes imputed wear time.



Relatedly, what is the difference between ENMO_fullRecordingMean and AD_mean_ENMO_mg_0-24hr? It seems from comparing the two metrics that the former may be calculated over all available days while the latter is based on valid days only (please see the attached .xlsx file for comparison). Is this correct?


>> Variables ending with " fullRecordingMean" are only calculated per recording and use any time segments it finds that is considered valid (monitor worn), even if a day has only one hour of valid data. Variables "_0-24hr" (where 0 and 24, can be any other number) on the other hand are first calculated per day including non-wear imputation. Next, you can set a minimum required number of hours, e.g. 16 by default.

This differentiation is helpful. Thanks!
 
Next, the person level aggregates represent the mean or weighted mean of those day-level estimates. This means that for the "fullRecording" variables we use as much data as possible, while for the "0-24" variables we only use data from days with a minimum number of valid hours.

That is clear now.



When computing ACC_nightandday_mg_wei based on part 5 day summaries, my numbers don’t seem to match with the part 5 summary output (please see the GGIR_Q1.xlsx file for an example of 3 subjects). Likewise, when computing plain average based on day summary data, my numbers do not add up to the ACC_nightandday_mg_pla. Thus, I am wondering what I may be missing in my calculations based on the day summary output to match the averages provided in part 5 summary. If anyone has had a similar issue, I would appreciate any feedback.


>> part2_summary is calculated with part2_daysummary, and part5_personsummary is calculated with part5_daysummary. What defines a valid day may differ between part 2 and 5, because they use different criteria for a valid day and in the case of WW daydefinition even a different time window. Please make sure you use the part 2 and part5 specific definition of valid days. It is not clear from your spreadsheet what information you used to define a (in)valid days.

 Thank you for your response. I did compare matching spreadsheets (i.e. part 5 day summary with part 5 person summary). Using the data from day summary p5 and adopting midnight-to-midnight window, I was unable to replicate values provided in person summary in part 5 in relation to:

1)       1. The number of valid days

2)     2.  Average ACC_nightandday_mg values

 

           In the vignette, it is advised that "part 5 derives sleep and physical activity characteristics by re-using information derived in part 2, 3 and 4". This suggests that the same minimum wear time criterion as specified in part 2 (in my case 16 hours) should be applied in part 5.

 

Thus, I computed a criterion variable (Valid day), using a criterion of less than 33% of nonwear time (explicitly: “nonwear_perc_day” < 33) within a 24hr (midnight-to-midnight). However, summing the number of valid days based on this criterion does not align with “Nvaliddays” reported in person summary, part 5. The discrepancies sometimes exceed 1 day (please see “P5_compare_summaries” tab in the spreadsheet; the second tab contains day summary data and computation of valid days).

 

1. Subjects #321, #329, #338 and #339 – have 0, 5, 1, and 0 valid days based on my adopted criterion (computed using day summary p5 output, see “P5_daysumm_ACC_avg” tab). In contrast, they have 1, 6, 3 and 1 valid days in part 5 person summary. Looking at the percentage of nowear_perc_day, I am unable to reconcile, how subject #321 could have one valid day based given 53.91, 63.84 and 100% nonwear on days recorded in day summary spreadsheet for that subject.

 

Would you be able to specify what criterion is adopted by GGIR to count day as valid in part 5?

1)     

       2. Average values for ACC_nightandday_mg included in p5 day summary output and averaged across valid days do not match the values included in p5 person summary output. Note that the discrepancy does not only occur for subjects where the number of valid days is different between those reported by a person summary p5 output and computed by me (please see the spreadsheet for details.)


Thank you in advance! 

 

My last question is related to whether the data from valid days only are accounted for in the computation of both metrics if a valid day criterion is specified (day summary outputs suggest that this is the case)? I am defining a valid day as one with at least 16 hours of valid wear time using includedaycrit = 16 argument. If this is the case, then the difference between two summary metrics would be that ENMO_fullRecordingMean excludes the periods of non-wear during valid days, while the non-wear periods within valid days only are accounted for (by imputation) in ACC_nightandday_mg_wei. Is this correct?


>> Hopefully my response above answers this. Note that "wei" indicates that day estimates are aggregated to person estimates by weighting weekend and weekdays proportionally, this has nothing to do with how non-wear is treated.

 

Yes, it does. Thanks! 


To unsubscribe from this group and stop receiving emails from it, send an email to Rpacka...@googlegroups.com.
P5_day_person_summary_avg_ACC_validday_mismatch.xlsx
RCode_v6.txt

kraf...@gmail.com

unread,
May 20, 2025, 6:29:44 PMMay 20
to R package GGIR
Hi Dominika,

Just curious, did you ever resolve the issue alluded to in your last message in this thread? In about 15% of cases I also find discrepancies between part2 summary and daysummary. Thanks,

Tom

Vincent van Hees

unread,
Jun 2, 2025, 11:00:11 AMJun 2
to kraf...@gmail.com, dominika, R package GGIR
Hi Tom,

It seems I missed Dominika's message from 2020. GGIR has evolved since then, so it may be easier to first check that the issue still applies. Also, it sounds like you are worried about GGIR part 2, while her question was about part 5 output.

If you want me to look at it, please:

  • Indicate specific variable names you compare and how you compare them.
  • Provide a reproducible example by sharing a .RData file from the GGIR output folder meta/basic and your R script.

Thanks,

Vincent

To unsubscribe from this group and stop receiving emails from it, send an email to RpackageGGIR...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/RpackageGGIR/4f0a84aa-01ae-4052-9129-60b025afbe1fn%40googlegroups.com.

Tom Kraft

unread,
Jun 2, 2025, 11:43:27 AMJun 2
to Vincent van Hees, dominika, R package GGIR
Hi Vincent, 

I believe that I have resolved this issue but will double check and provide a reproducible example if it persists.

Tom
Reply all
Reply to author
Forward
0 new messages