The code I

import sys
try:
    n = int(sys.argv[1])
except:
    n = 20  # no of points

# compute data points in x and y arrays,
# x in (0,1) and y=-2*x+3+eps, where eps is normally
# distributed with mean zero and st.dev. 0.25.

from Numeric import *
x = arange(0.0, 1.0, 1.0/n)
import RNG
dist = RNG.NormalDistribution(0.0, 0.25)
rng = RNG.CreateGenerator(2091, dist)
eps = rng.sample(n)  # vector of random samples
a_exact = -2.0; b_exact = 3.0
y = a_exact*x + b_exact + eps

previousnexttable of contents