Learn R Programming

GGIR (version 2.5-0)

g.analyse: function to analsyse meta-data generated by g.getmeta and g.impute

Description

Analyses the output from other functions within the packages to generate a basic descriptive summary for each accelerometer data file. Analyses include: Average acceleration per day, per measurement, L5M5 analyses (assessment of the five hours with lowest acceleration and with highest acceleration). Further, the traditionally popular variable MVPA is automatically extracted in six variants: without bout criteria in combination with epoch = epoch length as defined in g.getmeta (first value of the input argument windowsizes), 1 minute, and 5 minutes, and for bout durations 1 minute, 5 minutes or 10 minutes in combination with the epoch length as defined in g.getmeta.

Usage

g.analyse(I, C, M, IMP, qlevels = c(), qwindow = c(0, 24),
 quantiletype = 7, L5M5window = c(0, 24), M5L5res = 10,
 includedaycrit = 16, ilevels = c(),
 winhr = 5, idloc = 1, snloc=1, mvpathreshold = c(),
 boutcriter=c(), mvpadur=c(1,5,10),
 selectdaysfile=c(), window.summary.size=10,
 dayborder=0, bout.metric = 1,
 closedbout=FALSE, desiredtz = "",
 IVIS_windowsize_minutes = 60,
 IVIS_epochsize_seconds = NA, iglevels = c(), IVIS.activity.metric=2,
 qM5L5=c(), myfun=c(), MX.ig.min.dur=10)

Arguments

I

the output from function g.inspectfile

C

the output from function g.calibrate

M

the output from function g.getmeta

IMP

the output from function g.impute

qlevels

array of percentiles for which value needs to be extracted. These need to be expressed as a fraction of 1, e.g. c(0.1, 0.5, 0.75). There is no limit to the number of percentiles. If left empty then percentiles will not be extracted. Distribution will be derived from short epoch metric data, see g.getmeta.

qwindow

To specify windows over which all variables are calculated, e.g. acceleration distirbution, number of valid hours, LXMX analysis, MVPA. If value = c(0,24), which is the default, all variables will only be calculated over the full 24 hours in a day, If value =c(8,24) variables will be calculated over the window 0-8, 8-24 and 0-24. All days in the recording will be segmented based on these values. If you want to use a day specific segmentation then you can set qwindow to be the full path to activity diary file. See documentation g.conv.actlog for details.

quantiletype

type of quantile function to use (default recommended). For details, see quantile function in STATS package

L5M5window

Argument depricated after version 1.5-24. This argument used to define the start and end time, in 24 hour clock hours, over which L5M5 needs to be calculated. Now this is done with argument qwindow.

M5L5res

resoltion of L5 and M5 analysis in minutes (default: 10 minutes)

includedaycrit

minimum required number of valid hours in day specific analysis (NOTE: there is no minimum required number of hours per day in the summary of an entire measurement, every available hour is used to make the best possible inference on average metric value per average day)

ilevels

Levels for acceleration value frequency distribution in mg, e.g. c(0,100,200) There is no constriction to the number of levels.

winhr

Vector of window size(s) (unit: hours) of L5 and M5 analysis (dedault = 5 hours)

idloc

If idloc = 1 (default) the code assumes that ID number is stored in the obvious header field. Note that for ActiGraph data the ID never stored in the file header. For value set to 2, 5, 6, and 7, GGIR looks at the filename and extracts the character string preceding the first occurance of a '_', ' ' (space), '.' (dot), and '-', respecitvely. You may have noticed that idloc 3 and 4 are skipped, they were used for one study in 2012, and not actively maintained anymore, but because it is legacy code not omitted.

snloc

If value = 1 (default) the code assumes that device serial number is stored in the obvious header field. If value = 2 the code uses the character string between the first and second character '_' in the filename as the serial number

mvpathreshold

Threshold for MVPA estimation. This can be a single number or an array of numbers, e.g. c(100,120). In the later case the code will estimate MVPA seperately for each threshold. If this variable is left blank c() then MVPA is not estimated

boutcriter

The variable boutcriter is a number between 0 and 1 and defines what fraction of a bout needs to be above the mvpathreshold

mvpadur

default = c(1,5,10). Three bout duration for which MVPA will be calculated

selectdaysfile

Functionality designed for the London Centre of Longidutinal studies. Csv file holding the relation between device serial numbers and measurement days of interest.

dayborder

Hour at which days start and end (default = 0), value = 4 would mean 4am

window.summary.size

Functionality designed for the London Centre of Longidutinal studies. Size in minutes of the summary window

bout.metric

This argument used to be called mvpa.2014 and had TRUE or FALSE as its value. However, it has now become clear that this aspect of the analyses is still very much open for debate. Therefore, I have changed it into an argument where you can specify a metric for bout detection based on a number. A description of these bout metrics can be found in the new function g.getbout

closedbout

If TRUE then count breaks in a bout towards the bout duration. If FALSE then only count time spent above the threshold towards the bout duration.

desiredtz
IVIS_windowsize_minutes

see g.IVIS

IVIS_epochsize_seconds

depricate, see g.IVIS

iglevels

Levels for acceleration value frequency distribution in mg used for intensity gradient calculation (according to the method by Rowlands 2018). By default this is argument is empty and the intensity gradient calculation is not done. The user can either provide a single value (any) to make the intensity gradient use the bins c(seq(0,4000,by=25),8000) or the user could specify their own distribution. There is no constriction to the number of levels.

IVIS.activity.metric

see function g.IVIS

qM5L5

see function g.getM5L5

myfun

External function object to be applied to raw data, see g.getmeta.

MX.ig.min.dur

Value

g.analyse generated two data,franeL

summary

summary for the file that was analysed

daysummary

summary per day for the file that was analysed

These data.frames are used by function g.report.part2 to generate csv reports. An exaplantion of all the columns in the data.frame and subsequent csv reports can be found in the package vignette (Output part 2).

Examples

Run this code
# NOT RUN {
data(data.getmeta)
data(data.inspectfile)
data(data.calibrate)
# }
# NOT RUN {
  #inspect file:
  I = g.inspectfile(datafile)
  
  #autocalibration:
  C = g.calibrate(datafile) 
  
  #get meta-data:
  M = g.getmeta(datafile, desiredtz = "Europe/London", 
  windowsizes = c(5, 900, 3600),
  daylimit = FALSE, offset = c(0, 0, 0), 
  scale = c(1, 1, 1), tempoffset = c(0, 0, 0))
# }
# NOT RUN {

#impute meta-data:
IMP = g.impute(M = data.getmeta, I = data.inspectfile)

#analyse and produce summary:
A = g.analyse(I = data.inspectfile, C = data.calibrate,
M = data.getmeta, IMP)

# }

Run the code above in your browser using DataLab