Note: I do not have access to
SAS so I am trying to interpret the code off the macro syntax.
I have frequency-weighted data of nutrition intakes. The frequency weights are integer. This is from a repeated measures dietary study where some respondents have two measures of intake, and others have one measure. (Note: this is test data to get my
R method validated against a
SAS method, the data of interest will have most if not all of the respondents having two replications.) The data have had a Box Cox transformation to linearity, and I have used a nonlinear mixed methods approach to estimate the long-run nutrient intakes (frequency weights were used in this analysis).
The next step to to generate 100 replicates for each individual and back-transform using a Taylor series approximation (basically lines 355 to 360 of the linked code). Some detail of the MC method for replicates: the replicates are generated by taking the random effect for the individual from the nonlinear mixed methods analysis, and adjusting by their standard deviation * a pull from the random normal distribution. This is shown in lines 322 and 323 of the linked code here. I am using
Notepad++ to get the code line numbering.
The macro code has me slightly lost with what is happening with the weights, as an earlier macro had a lot of weight construction in it, in particular calculating group weights (summing within agegroup) and total weight. Lines 173-203 of the code seem to be replicating this earlier work, which enables distributions to be output for each group. Lines 206 to 229 just create the overall group, again appears to be replicating the content of an earlier macro (see last paragraph). There is an adjusted weight calculation on line 306, inside the MC simulation, which appears to be dividing the individual weight by the number of replicates, and then dividing by the group weight. I think this calculation is done so that, on line 380,
totsum takes one of the values shown in the comment, and therefore
adjwt perhaps isn't a "real" weight. Lines 411 to 536 estimate and output the population distribution - and I can't see any use for the weights apart from tie cutpoints (line 473).
The research question is: what is the long-run distribution of nutrient intakes in the population?
My questions are: am I correct in thinking that the frequency weights are only being used for making decisions around cutpoints? If not, what did they do? If I am correct, is it usual to ignore frequency weights when constructing the estimated population distribution in this type of analysis (nonlinear mixed effect model followed by Monte Carlo simulation)?
(I'm working with amount data, so the probability (probability of consumption) aspects are not of interest as they are only used when the nutrient of interest is not regularly consumed. For example, nutrients such as energy or protein have no probability of consumption component as this is equivalent to 1, whereas alcohol, or particular foods, would need a probability of consumption component as they are not regularly consumed by many people.)
The earlier macro that does the initial group and total weighting calculations is here, see lines 426 to 516. This macro is run ahead of the other, to produce the estimates used for the simulation and distribution estimates, so it has the Box Cox transformation code etc in it.
If you wish to examine the method for yourself, I am using Example 1 from here. You will need SAS to run the code, although the syntax, output, and log files are text files.