I'm a programmer but I don't know much about stats, so please excuse me if this question sounds naive.

I have two computers that are in different locations. I have made N measurements for the network distance between them. So it's essentially a series of N numbers like 200ms, 173ms, 212ms....

Now, I need to write a simulator that simulates these two computers. What I need is a generator that can generate new network distances between them. So for instance, if the generator generates something like 183ms, then it'd be reasonable. But if it generates, say, 1 billion ms, then that wouldn't make sense since it deviates so much from the original data set.

So how would I generate new numbers that are similar to the numbers in the original series?

P.S. I'm not sure what tags I should use for this question because I don't know much about stats... feel free to add tags that you think are more appropriate.

  • $\begingroup$ How big is your N? How many new numbers will you need? (Order of magnitude answers are fine.) Can you post a histogram of the values? If they look anything like a normal distribution, you could just simulate random normal variables with the same mean and standard deviation as your data. $\endgroup$ – Gregor - reinstate Monica Mar 5 '15 at 5:45

a) The most obvious thing to do is

  • resample your data. If your sample is very large this makes a lot of sense

b) If you want different numbers to the ones you already have, you could:

  • find a reasonable approximation to your observed data, possibly some well-known distribution, perhaps some finite mixture of distributions. Gammas, lognormals, inverse Gaussians, or in some situations even something like a Pareto might be reasonable.

Here's an example of data where lognormal and Gamma distributions are reasonable approximations (but the data aren't actually from either of those distributions)

enter image description here

c) If resampling makes sense to you but you still want different numbers to your original sample, you might

  • take a smooth kernel (a little probability distribution) around each data point. This corresponds to sampling from a kernel density estimate. If you do this, I'd suggest working with a transformation -- times are often very right skew, but speeds/rates (inverse times) or log-times are often much less skew (in which case ordinary KDEs will work better on the less skewed transformed times). You can then sample the KDE on the transformed scale and then transform back to get times.

enter image description here

This was generated by

  1. resampling a power transform of the data (transformed to near symmetry)
  2. adding Gaussian noise of a scale suitable for a kernel density estimate
    (this is equivalent to sampliing from a KDE)
  3. transforming back to the original scale

You could just resample.

Let's take a simple example. Suppose N=1000, meaning you have 1000 network distances from those two computers. Draw a 3 digit uniform random number (from 000 to 999 or 0 to .999) and then pick the distance that number corresponds to in your list of 1000 network distances.

This approach makes no distributional assumptions -- i.e. you aren't assuming the distances are normal, or exponential or some other distribution.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.