0
$\begingroup$

I am trying to simulate the diet of the participants of an observational cohort (say n=10,000 - but could be larger). The purpose is two-fold: first I would like to use this to test some scripts, but second it would also be useful for teaching (to provide students with data as close as possible to real life without using actual data - which can be difficult).

The data I would like to simulate is the amount of intake of different foods (several 100), which in a future step can then be used to estimate intake of carbohydrates, fats etc.

My initial approach has been the following (i: subject, j: food, D: amount consumed; min: minimum j amount consumed, max: maximum j consusmd)

D[i,j] <- runif(1,min[j],max[j]) 

(I have also used log-normal or normal distributions, this does not make a big difference)

The 'problem' occurs if I create several simulated cohorts. Each simulated participant will be different, but the mean intake of each food will be virtually the same. In hindsight, this is not surprising as the (pesudo)random values are all taken from the same distribution.

What I am looking for is a method to create different simulated datasets, and this might be clearer with an example with just one food (say wine, average daily consumption between 0 and 750 g):

A single cohort (n=10,000) can thus be simulated as:

 D <- runif(n,0,750)

The mean wine intake in this cohort is approximately 375 g/d, and this remains fairly constant with every repeat.

What I would like is to have not only different intakes in each individual, but also a different cohort-mean for each simulation. Is this possible?

$\endgroup$
  • 1
    $\begingroup$ It is possible, but the situation you describe with the weight of 4 meals seems to be properly modeled by the sum of 4 rv’s. If you want a larger spread, consider just taking a single uniform value between 0 and 400. $\endgroup$ – KenHBS Nov 25 '17 at 9:14
  • 4
    $\begingroup$ You'll need to explain what behavior you seek more clearly. $\endgroup$ – Glen_b -Reinstate Monica Nov 25 '17 at 10:54
  • 1
    $\begingroup$ The distribution is always fixed. You can't generate "more random" numbers. They aren't even random to begin with, rather they're pseudo random. The properties of that distribution, however, can be expanded to reflect more biologically plausible data. Describe patterns and trends from research elsewhere and emulate them with a well articulated model. Pay particularly attention to skewness, multimodality, heaping, and so on. Edit your question to describe these details. $\endgroup$ – AdamO Nov 25 '17 at 13:38
  • 3
    $\begingroup$ The more specification you have for "randomness" the easiest it becomes to design a random distribution for each type of intake. $\endgroup$ – Xi'an Nov 25 '17 at 14:50
  • 2
    $\begingroup$ It would help a lot to describe the setting more. What is D, for example? What units? What does it represent in the real world? What is an observation? Is it a person-day? Is it a person-year? What is the structure of the desired data? Cross-section? Time series? Longitudinal? What are the four uniform random variables? Units? What are they supposed to measure? How many variables per observation should be in the final dataset? What are they? Can you give, descriptively or via a link, an example of the kind of data you are trying to emulate? $\endgroup$ – Bill Nov 25 '17 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.