I am dealing with numeric ranges obtained from a normal population that represent +- 2 standard deviations from the mean. Abnormal values are those that extend out past the 2SD limits. I want to generate random values that are skewed to look like the population data. So that I provide a mean and the +-2SD range to a function that generates numbers that produce a perfect bell curve that looks like the original population. So for example, take a lab test like glucose with a reference range of 60 - 100. This represents the values that would be obtained by testing a large group of normal people. The mean is 80 and the 2SD range is 60-100. That is 95% of the total population by definition. Values can extend out from below 50 upwards to 500. I would like to generate random numbers that fit these parameters.
I am playing with numpy and scipy but I don't understand the math very well. Is there a function that will do this?
source https://stackoverflow.com/questions/71212542/python-generate-random-numbers-with-n-standard-deviations-of-a-mean
Comments
Post a Comment