Calculate statistics over multiple (consecutive) records

For clustered data, this function was used to calculate statistics for each cluster; for time-series data, this function was used to calculate statistics over moving time-windows.

For example, in a longitudinal study you follow up 200 women and have daily urine hCG tested for 3 months, you want to calculate the 7-days hCG slope to determine if there is a significant hCG rise during any 7-days’ period.

Using demo.xls as an example, in demo.xls each family (FMYID is family ID) have 1 to 9 subjects, each subject had SBP and DBP measured.  You had first applied “residual and predicted” function adjust SBP and DBP by SEX, AGE, BMI, smoke and education and calculated the residual SBP and DBP, and now you want to calculate the mean, median, Q1 and Q3 of residual SBP and residual DBP for each family.  A screen shot of this example is as below:

A screen shot of sample input window:

ScreenHunter_07 Jan. 02 21.06.gif

Notes:

1.       The left variables list originally lists all variables.  Select the variable and then click “>” or “<” to move the variables between “variables” list to selected list “Time variable”, “ID”, “variables for calculate”.

2.       If time variable is specified, you can further specify the time-window for calculate statistics over moving time-windows. The parameter for specify the time-window includes the width and location (left side, middle, or right side in refer to any specific time point).

3.       In above example, “FMYID” likes subject identification. This function will calculate mean, median, Q1 and Q3 of residual SBP and DBP for each family.  Basically, this function will output only 1 record for each family.  However, if you uncheck the “Output only 1 record for each ID”, this function will append the output statistical variables to each subject’s record.

 

Click “Run”, a new sub-node (node text is the output file name) will be added to left tree view under node “Data”. 

 

View output files

 

Right click the node, and then select the output file to view.

 

ScreenHunter_08 Jan. 02 21.07.gif

 

A sample output of this example is as below:

ScreenHunter_09 Jan. 02 21.35.gif