Learn R Programming

GGIR (version 2.3-0)

g.impute: function to identify invalid periods in the meta-data as generated by g.getmeta and to impute these invalid periods with the average of similar timepoints on other days of the measurement

Description

Functions takes the output from g.getmeta and information about the study protocol to label impute invalid time segments in the data.

Usage

g.impute(M, I, strategy = 1, hrs.del.start = 0, hrs.del.end = 0, 
maxdur = 0, ndayswindow = 7,desiredtz="", dayborder= 0, TimeSegments2Zero =c())

Arguments

M

output from g.getmeta

I

output from g.inspectfile

strategy

how to deal with knowledge about study protocol. value = 1 means select data based on hrs.del.start, hrs.del.end, and maxdur. Value = 2 makes that only the data between the first midnight and the last midnight is used for imputation. Value = 3 only selects the most active X days in the file where X is specified by argument ndayswindow. Value = 4 to only use the data after the first midnight.

hrs.del.start

how many HOURS after start of experiment did wearing of monitor start?

hrs.del.end

how many HOURS before the end of the experiment did wearing of monitor definitely end?

maxdur

How many DAYS after start of experiment did experiment definitely stop? (set to zero if unknown = default)

ndayswindow

If strategy is set to 3 then this is the size of the window as a number of days

desiredtz
dayborder
TimeSegments2Zero

Optional data.frame to specify which time segments need to be ignored for the imputation, and acceleration metrics to be imputed by zeros. The data.frame is expected to contain two columns named windowstart and windowend, with the start- and end time of the time segment in POSIXlt class.

Value

metashort

imputed short epoch variables

rout

matrix to clarify when data was imputed for each long epoch time window and the reason for imputation. Value = 1 indicates imputation. Columns 1 = monitor non wear, column 2 = clipping, column 3 = additional nonwear, column 4 = protocol based exclusion and column5 = sum of column 1,2,3 and 4.

averageday

matrix with n columns for n metrics values and m rows for m short epoch time windows in an average 24 hours period

Examples

Run this code
# NOT RUN {
  #inspect file:
  I = g.inspectfile(datafile)
  
  #autocalibration:
  C = g.calibrate(datafile) 
  
  #get meta-data:
  M = g.getmeta(datafile)
# }
# NOT RUN {
data(data.getmeta)
data(data.inspectfile)

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

# }

Run the code above in your browser using DataLab