I was wondering if there are time-efficient algorithms that can reverse the process of basic statistics computation. What I mean is an algorithm that instead of computing the mean, SD, max-min range, median... based on input values, would do the inverse operation, i.e generating a set of data with the required/wanted statistical results. What seems the most optimal way to solve such problems ? Thought about genetical algorithms, but maybe are there better ways.

If you want to know why I'm searching to do this : I'm a student in sport science field and my project is about generating an AI that would detect when people fake their data to proove their point. I want to know what would be the best algorithms to fake such results, so maybe I could detect people already doing that. Thanks !


1 Answer 1


I think the general concept you're describing is sampling from a distribution. If the distribution in question is known and has nice properties, there are typically closed-form equations for doing the sampling based on generating uniform random numbers. For example, if I want to generate numbers that fit a normal distribution with mean $\mu$ and standard deviation $\sigma$, I can use the Box-Muller Transform.

For more general cases where you don't necessarily have a handy way of writing down the distribution and dealing with potentially thousands of parameters, we turn to methods like Markov Chain Monte Carlo (MCMC).

I'm not sure if that's exactly what you had in mind or not, because it feels like you might not know the distribution you want to sample from here, but there are enough parallels that it's probably worth some time to dive in a little deeper.

  • $\begingroup$ Thank you for your answer. Indeed I think the Box-Muller transform is what I need as a large part of physiological and biological data follow a Normal distribution. That's exactly what I needed, and I didn't know we call that sampling. Nice ! And Markov Chain Monte Carlo might also be useful. Thank you for this ! $\endgroup$
    – Anselme
    Commented Dec 8, 2022 at 16:54
  • $\begingroup$ If you just need to sample from a Gaussian, you don't even need to implement something like Box-Muller yourself. Most programming languages have a library function that handles it for you. In Python, you could use numpy.random.normal(x, y) for example to generate samples from a distribution with mean=x and std=y. Box-Muller is how you might implement such a function yourself, but you shouldn't have to. $\endgroup$
    – deong
    Commented Dec 9, 2022 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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