Lippincott Williams & Wilkins



SDC 2 Appendix I: Detailed instructions to apply activpalProcessing R packageThe R package provided with this manuscript can be used to estimate physical activity and sedentary behavior variables from activPALTM “events” files. See the activPAL User Manual for instructions on downloading and saving events files. The package contains 19 functions created to help applied researchers process and interpret data from the AP events files. 18 of the functions provided can be used independently (according to the user manual) and provide the user the flexibility of processing data sets as they prefer. The function process.AP uses all other functions in the package and was designed to automate AP processing for a given data set. To use the function process.AP, minimal R code is required, however several steps must be followed: 1) a working directory must be created, 2) AP events files must be saved (using a specific naming convention described below) in the working directory and 3) a log identifying each subject/visit combination (log of subjects)must be saved in the working directory. Logs identifying wear/non wear time and sleep/wake time are optional. If logs are provided non-wear and sleep time will be identified and ignored when daily PA and SB variables are estimated. If logs are not provided the package will estimate PA and SB variables from the complete AP file (e.g. non-wear and sleep time are included in daily estimates). The purpose of this appendix is to provide detailed instructions on the use and functionality of this package, specifically the function process.AP.FunctionalityThe function process.AP will use the information provided in the log of subjects to batch process AP events files saved in the working directory. Results of the batch processing will be summarized in three files: 1) Sleep Wake Wear Table, 2) Results Table and 3) Means Table. The Sleep Wake Wear Table is a record of wear/non wear time and sleep/wake time. These variables are calculated based on wear and bed logs provided by the user. If logs are not provided, or if the data reported in the logs are invalid, this will be indicated in the Sleep Wake Wear Table file. Detailed instructions on how to make and use wear and bed logs are provided in the Instructions section below.The Sleep Wake Wear Table contains the following variables.study – The study name.Identified from the log of subjectssub – Subject name or ID.Identified from the log of subjects and corresponding to the AP events file with the matching ID visit – Study visit or time point (e.g. baseline, visit 1 etc).Identified from the log of subjects and corresponding to the AP events file with the matching visit codedate – Date of interest. Variables are estimated per calendar day.Identified from AP events file and wear logawake.hours – Hours of day awake.Calculated from bed log total.sleep.hours – Hours of day asleep.Calculated from bed log total.wear.hours – Hours of day AP was worn.Calculated from on/off log non.wear.hours - Hours of day AP was not worn.Calculated from on/off log hours.awake.worn - Hours of day subject was awake and wearing the AP Calculated from bed and on/off loghours.awake.not.worn - Hours of day subject was awake and not wearing the AP Calculated from bed and on/off log hours.sleep.worn - Hours of day subject was asleep and wearing the AP Calculated from bed and on/off log hours.sleep.not.worn - Hours of day subject was asleep and not wearing the AP Calculated from bed and on/off log Note: If valid bed and on/off logs are provided values for variables 5-12 range from 0-24, however it is recommended that the user verify these values for the given study and sample being measured (e.g. is it realistic that subjects are awake for 24 hours?) If data do not pass the user’s quality control check, verify data in bed and on/off logs are correct. If a bed log is not provided (or contains invalid data), variables 5-6 and 9-12 will have the value "No valid bed.log data". If an on/off log is not provided (or contains invalid data), variables 7-8 and 9-12 will have the value "No valid on.off.log data". If neither a bed nor on/off log is provided (or contain invalid data), variables 5-12 will have the value "No valid bed.log or on.off.log data".The Results Table file contains the following variables. study – The study name.Identified from the log of subjectssub – Subject name or ID.Identified from the log of subjectsvisit – Study visit or time point (e.g. baseline, visit 1 etc).Identified from the log of subjects and corresponding to the AP events file with the matching visit codedate – Date of interest. Variables are estimated per calendar day.Identified from AP events file and wear loghours.awake.worn - Hours of day subject was awake and wearing the AP Calculated from bed and on/off logmet.hours – A MET is a rate of intensity where 1 MET is approximately equal to 1 kcal/kg/hour and roughly equivalent to the energy cost of sitting quietly. MET-hours are calculated by multiplying the MET value of a given activity by the duration (in hours) it was performed. In this study, MET-hours for all daily activities are then summed to provide an estimate of total daily physical activity. Calculated by summing the AP estimate of MET-hours (column named “Activity Score” in events file).step.count – Total number of steps per dayCalculated by summing total steps per day from AP estimate of steps (column named “CumulativeStepCount” in events file).sed.mins – Total time spent sitting/lying per dayCalculated according to the AP estimate of sitting/lying (column named “Activity Code”, where 0=sitting/lying) minutes in sitting/lying are summed.stand.mins – Total time spent standing per dayCalculated according to the AP estimate of standing (column named “Activity Code”, where 1=standing) minutes in standing are summed. step.mins – Total time spent stepping per dayCalculated according to the AP estimate of stepping (column named “Activity Code”, where 2=stepping) minutes in stepping are summed.lit.mins – Total time spent in light intensity (1.5-2.99 METs) activity per dayCalculated by dividing the AP estimate of MET-hours per event (column named “Activity Score” in events file) by the duration of the event (column named “Interval” in the events file) in minutes. Minutes in light intensity are summed.mvpa.mins – Total time spent in moderate-to-vigorous intensity activity (≥3 METs) activity per dayCalculated by dividing the AP estimate of MET-hours per event (column named “Activity Score” in events file) by the duration of the event (column named “Interval” in the events file) in minutes. Minutes in mvpa are summed. breaks – Absolute number of breaks from sitting/lyingCalculated by summing every instance the “Activity Code” transitions from sitting/lying (0) to either standing (1) or stepping (2). break-rate – Number of breaks from sitting/lying per sitting/lying hourCalculated by dividing absolute number of breaks by hours spent siting/lying. guideline.minutes – Minutes in bouts of activity that qualify towards meeting the physical activity guidelinesCalculated by identifying every instance where activity intensity is at least 3 METs for at least 10 minutes and summing the minutes. In this calculation a bout is ended when the last 10 minutes of the potential bout contain more than 2 minutes of < 3 MET activity. Using this approach, activity intensity is allowed to drop below 3 METs for no longer than 20% of the entire bout duration. For example, a 10 minute bout allows 2 minutes (2 = 20% of 10) to be <3 METs, a 30 minute bout allows 6 minutes (2 = 20% of 30) to be <3 METs. The rational for this leeway is to allow bouts that are predominantly MVPA, but require short interruptions to be counted as a single bout of MVPA. For example, consider an individual performing a 30-minute run outside for exercise. It is likely he/she will have to stop intermittently to cross streets. By allowing 20% of the bout to be <3 METs, we increase the likelihood that this will be identified as a single, 30-minute bout of MVPA. num.guideline.bouts – The number of bouts of activity that qualify towards meeting the physical activity guidelinesCalculated by identifying every instance where activity intensity is at least 3 METs for at least 10 minutes (as described above) and summing the absolute number of discrete bouts. min.in.sed.30 – Minutes in sitting/lying bouts that last at least “x” minutes. The duration of sitting time (x) can be specified by the user. For the purposes of this study we defined x as 30 min (and 60 min – below). Calculated by identify all bouts of sitting/lying ≥ 30 minutes in duration and summing minutes for each bout.min.in.sed.60 – Minutes in sitting/lying bouts that last at least “x” minutes. The duration of sitting time (x) can be specified by the user. For the purposes of this study we defined x as 60 min (and 30 min – above). Calculated by identify all bouts of sitting/lying ≥ 60 minutes in duration and summing minutes for each bout.num.bouts.in.sed.30 – The number of bouts of sitting/lying that last at least “x” minutes. In this instance, x=30. Calculated by identify all bouts of sitting/lying ≥ 30 minutes in duration and summing the absolute number of discrete bouts.num.bouts.in.sed.60 – The number of bouts of sitting/lying that last at least “x” minutes. In this instance, x=60. Calculated by identify all bouts of sitting/lying ≥ 60 minutes in duration and summing the absolute number of discrete bouts.percent.of.hours.awake.worn.sed – Total time spent sedentary expressed as a percent of waking time and wear timeCalculated by dividing total sedentary time (variable sed.mins) by the total time the participant was awake and wearing the AP (variable hours.awake.worn).percent.of.hours.awake.worn.lit – Total time spent in light intensity activity expressed as a percent of waking time and wear timeCalculated by dividing total time in light intensity (variable lit.mins) by the total time the participant was awake and wearing the AP (variable hours.awake.worn).percent.of.hours.awake.worn.mvpa – Total time spent in MVPA expressed as a percent of waking time and wear timeCalculated by dividing total time in MVPA (variable mvpa.mins) by the total time the participant was awake and wearing the AP (variable hours.awake.worn).Note: It is recommended that the user verify PA and SB values are realistic for the given study and sample being measured. If data do not pass the user’s quality control check, verify data in bed and on/off logs are correct and data in the AP events file are valid. If bed and on/off logs are not used, sleep and non-wear time will be included in the estimate of PA and SB variables. This may inflate SB variables, as sleep and non-wear time may ‘look like’ sedentary time.The Means Table summarizes (average, SD and 95 percent CI) the variables in Results Table by subject and visit.Step-by-step instructionsThe following steps will guide researchers with no previous R experience in using the function process.AP to automate AP processing for a given data set.Download and Install R: R is a free and open source software environment for statistical computing. To download R follow instructions on the R project home page – r-.Install R package activpalProcessing: Search the CRAN (binaries) repository for the package named activpalProcessing and install. Or see example code in SDC 1 for example code on installing packages.Create a folder that will serve as your working directory: This folder will be the home of all files needed to process AP events files. This will also be where the function process.AP saves the output files (e.g. Sleep Wake Wear Table, Results Table and Means Table).AP events files: Save AP events files in your working directory. Naming convention – Events files must be saved as a .csv file with the naming format “study_id_visit.csv", where study, id and visit correspond to the information provided in the log of subjects. For example, if study name = PhysicalActivityIntervention, subject id = 1, visit = 3 the events file is named “PhysicalActivityIntervention_1_3.csv”. Note: spaces within the name of a file are not supported by R (e.g. “Physical Activity Intervention”).Files must be saved in the exact format they are downloaded in from the AP software. To ensure the AP events files are in the correct format, we recommended you change the name to the proper convention without opening the file. Create a log of subjects: This log identifies every AP events file to be processed by listing each unique subject and visit combination for the study of interest.Data format – The log of subjects must contain three variables named 1) id, 2) visit and 3) study. id – subject specific identifier visit – each time point AP was wornstudy – study name Create a bed log: This log identifies sleep/wake time for participants. Data format – The .csv file must contain 15 variables named 1) id, 2) visit, 3) study, 4) date.out.month, 5) date.out.day, 6) date.out.year, 7) time.out.hour, 8) time.out.minute, 9) time.out.seconds, 10) date.in.month, 11) date.in.day, 12) date.in.year, 13) time.in.hour, 14) time.in.minute, 15) time.in.seconds. There may be more than one entry for a given date if the participant reported multiple sleep periods (e.g. napping).id, visit and study must be formatted identically to what was used in the log of subjectsdate.out.month, date.out.day and date.out.year – these variables correspond to the calendar date of interest. There should be at least one entry for each day the AP was worn, unless the participant did not sleep on a given day. time.out.hour, time.out.minute and time.out.seconds – these variables correspond to the time of day the participant reported getting out of bed on the corresponding date. Must be in format h:mm:ss using 24-hour clock (e.g. 1:00 pm = 13:00:00).date.in.month, date.in.day and date.in.year – these variables correspond to the calendar date of interest. Date.in variables may be different than corresponding date.out variables (e.g. the participant went to bed after midnight). time.in.hour, time.in.minute, time.in.seconds – these variables correspond to the time of day the participant reported getting in bed on specified date. Must be in format h:mm:ss using 24-hour clock (e.g. 1:00 pm = 13:00:00).Create an on/off log: This log identifies wear/non-wear time for participants. Data format – The .csv file must contain 15 variables named 1) id, 2) visit, 3) study, 4) date.on.month, 5) date.on.day, 6) date.on.year, 7) time.on.hour, 8) time.on.minute, 9) time.on.seconds, 10) date.off.month, 11) date.off.day, 12) date.off.year, 13) time.off.hour, 14) time.off.minute, 15) time.off.seconds. There may be more than one entry for a given date if the participant reported putting the AP on at two different time points (e.g. after a morning shower and after a nighttime shower). If the participant did not put the monitor on for a given date (either because they did not wear the AP at all or because they wore it from midnight through midnight), there will be no entries for this date.id, visit and study must be formatted identically to what was used in the log of subjects and bed log.date.on.month, date.on.day and date.on.year – these variables correspond to the calendar date of interest.time.on.hour, time.on.minute and time.on.seconds – these variables correspond to the time of day the participant reported getting out of bed on the corresponding date. Must be in format h:mm:ss using 24-hour clock (e.g. 1:00 pm = 13:00:00).date.off.month, date.off.day and date.off.year – these variables correspond to the calendar date of interest. Date.in variables may be different than corresponding date.on variables (e.g. the participant removed the device after midnight). time.off.hour, time.off.minute, time.off.seconds – these variables correspond to the time of day the participant reported getting in bed on specified date. Must be in format h:mm:ss using 24-hour clock (e.g. 1:00 pm = 13:00:00).Note: The naming convention and data within each log outlined above require very specific formatting. Data within files are sensitive to capitalization. Follow directions carefully. Example logs are provided within the R package. We recommend using these examples as templates for creating logs. See SDC 1 for sample code to export these examples as templates to the working directory.Run R script: Once the working directory containing the AP events files and appropriate logs are created, an R script can be created and run. If the directions above are followed correctly, only a few lines of code will be required to process multiple AP files and produce estimates of PA and SB variables. SDC 1 is an example of a directly executable R script. This file can serve a template for the user to process AP events files using the function process.AP. There are 6 steps to using this template, described below.Step 1 – Install the activpalProcessing package and libraryCode to be edited – noneStep 2 – identify the path of your working directoryCode to be edited – replace “/Users/jsmith/Documents/PAI_Directory/” with the appropriate path information for your working directory (the path must be contained in quotations). Note that PC’s and Mac’s have different formats for identifying the path of documents. We recommend creating the folder where your directory will be housed and then using the ‘Get Info’ or ‘Properties’ feature to identify the exact location of the folder.Step 3 – load example logsCode to be edited – noneStep 4 – export example logs to working directoryCode to be edited – noneStep 5 – use example logs exported in Step 4 as templates to create your own logsThere is no code associated with this step. To complete this step, open the exported example logs (saved as .csv files in the working directory (Step 4)) and edit according to your study.Step 6 – use the function process.AP to estimate PA and SB variables from the AP events files saved in the working directoryCode to be edited – replace “log.subjects”, “log.bed” and “log.on.off” with their appropriate names (e.g. how they are saved in your working directory). Each name must be contained in quotes.Once the code has been adapted accordingly and all necessary files are saved in the working directory, the code can be run. To do this, 1) highlight the entire script using ‘Crtl+A’, 2) If you are using a mac use ‘command+enter’ to begin processing, or 3) If you are using a PC use ‘Ctrl+R’ to begin processing. Processing the data may take a few minutes to several hours depending on how many files you are processing. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download