The point of this analysis is to produce a cleaned distribution of nutrient intakes for the Australian population, using two 24-hour intake recall periods. The general method being followed is from here where the method has been implemented for SAS. I was a SAS programmer for around 12 years, but never had much to do with macros as all my programming tasks were one-offs. This has meant that understanding the SAS code has taken me a reasonable period of time.
The approach will use the data sets constructed in the previous blog post, which I cleaned in Excel using VBA.
The main steps are:
- Identify a test data set (in this case, energy (KJ) intake),
- Reprogram the SAS code into R, hard coding in the variable names from the cleaned data set as these will be standard for the data analysis of the various nutrients,
- Compare the output distribution to that obtained by the previous method of analysis, then if all goes well
- Output the cleaned distribution to a .csv file for subsequent use by the client, and then finally
- Automate the process for the client, e.g. include GUI features for the client to select the input .csv data set, so the user does not need to change any of the R code.
- the MASS package is used to Box Cox transform the data to normality,
- the reshape2 package is required to melt the data so that repeated measures are separate observations, not separate variables - this will double the length of the data set as all observations have two 24-hour recall periods, and
- mixed effects analysis is being undertaken using lme4.
Along the way, I will be doing some additional testing. The NCI method linked above uses a number of covariates, such as age group. The client has been analysing the data (not using the NCI method) separately by age group. I will be testing the effect on the overall intake distribution by:
- analysing separately for age group (3 age groups), versus
- using age group as fixed effect covariates, versus
- using age-in-years as a continuous fixed effect variable instead of age group covariates (there are >4000 observations so there are multiple observations per age-in-years)