Welcome, guest | Sign In | My Account | Store | Cart

Create a deliberately bad normal distribution for sample data - varying the badness, mean, standard deviation and range of results shown.

Python, 17 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from numpy.random import normal
from scipy.stats import norm as normStat


CRAZINESS = 0.1
MIN = 50 
MAX = 300
STEP = 5
AVG = 180
DEV = 40 
p = normStat(AVG, DEV).pdf

def noise():
    return 1 + CRAZINESS * normal(1)

for x in range(MIN, MAX, STEP):
    print str(x), "\t",   p(x) * noise()

2 comments

tat.wright (author) 14 years, 8 months ago  # | flag

Data can be pasted directly into spreadsheets.

On linux machines this can be done using

python program.py | xclip

Nugroho Adi Pramono 14 years, 7 months ago  # | flag

or using excellerator to save output into .xls format