Exemple #1
0
def report(Zs):
    Z2s = []
    abses = []
    phzes = []
    reals = []
    imags = []
    for Z in Zs:
        Z2s.append(conj(Z) * Z)
        abses.append(abs(Z))
        phzes.append(phz(Z))
        reals.append(real(Z))
        imags.append(imag(Z))
        if (print_details):
            print "%11.7f %11.7f" % (Z.real, Z.imag)
            #print "%11.7f %11.7f" % (abs(Z), phz(Z))
    print
    print >> sys.stderr, "E[Z]      =", stats_m.find_mean(Zs)
    print >> sys.stderr, "E[|Z|^2]  =", stats_m.find_mean(Z2s)
    print >> sys.stderr, "E[abs(Z)] =", stats_m.find_mean(abses)
    print >> sys.stderr, "E[phz(Z)] =", stats_m.find_mean(phzes)
    print >> sys.stderr, "E[re(Z)]  =", stats_m.find_mean(reals)
    print >> sys.stderr, "E[im(Z)]  =", stats_m.find_mean(imags)
    print
Exemple #2
0
def report(Zs):
	Z2s = []
	abses = []
	phzes = []
	reals = []
	imags = []
	for Z in Zs:
		Z2s.append(conj(Z)*Z)
		abses.append(abs(Z))
		phzes.append(phz(Z))
		reals.append(real(Z))
		imags.append(imag(Z))
		if (print_details):
			print "%11.7f %11.7f" % (Z.real, Z.imag)
			#print "%11.7f %11.7f" % (abs(Z), phz(Z))
	print
	print >> sys.stderr, "E[Z]      =", stats_m.find_mean(Zs)
	print >> sys.stderr, "E[|Z|^2]  =", stats_m.find_mean(Z2s)
	print >> sys.stderr, "E[abs(Z)] =", stats_m.find_mean(abses)
	print >> sys.stderr, "E[phz(Z)] =", stats_m.find_mean(phzes)
	print >> sys.stderr, "E[re(Z)]  =", stats_m.find_mean(reals)
	print >> sys.stderr, "E[im(Z)]  =", stats_m.find_mean(imags)
	print
Exemple #3
0
	expected_mean_t = 0.0
	expected_var_s  = s
	expected_var_t  = t
	expected_cov_st = min(s, t)

elif which_process == 'bbbm' or which_process == 'bbsde':
	expected_mean_s = X0 + s/T*(XT-X0)
	expected_mean_t = X0 + t/T*(XT-X0)
	expected_var_s  = s*(T-s)/T
	expected_var_t  = t*(T-t)/T
	if s < t:
		expected_cov_st = s*(T-t)/T
	else:
		expected_cov_st = t*(T-s)/T

mean_s = stats_m.find_mean(slice_s)
mean_t = stats_m.find_mean(slice_t)
var_s  = stats_m.find_sampvaraux(slice_s, mean_s)
var_t  = stats_m.find_sampvaraux(slice_t, mean_t)
cov_st = stats_m.find_sample_covariance(slice_s, slice_t)

diff_mean_s = mean_s - expected_mean_s
diff_mean_t = mean_t - expected_mean_t
diff_var_s  = var_s  - expected_var_s
diff_var_t  = var_t  - expected_var_t
diff_cov_st = cov_st - expected_cov_st

if which_process == 'bm':
	print 'T  = %11.7f' % T
elif which_process == 'bbbm' or which_process == 'bbsde':
	print 'X0 = %11.7f' % X0
Exemple #4
0
    expected_mean_t = 0.0
    expected_var_s = s
    expected_var_t = t
    expected_cov_st = min(s, t)

elif which_process == 'bbbm' or which_process == 'bbsde':
    expected_mean_s = X0 + s / T * (XT - X0)
    expected_mean_t = X0 + t / T * (XT - X0)
    expected_var_s = s * (T - s) / T
    expected_var_t = t * (T - t) / T
    if s < t:
        expected_cov_st = s * (T - t) / T
    else:
        expected_cov_st = t * (T - s) / T

mean_s = stats_m.find_mean(slice_s)
mean_t = stats_m.find_mean(slice_t)
var_s = stats_m.find_sampvaraux(slice_s, mean_s)
var_t = stats_m.find_sampvaraux(slice_t, mean_t)
cov_st = stats_m.find_sample_covariance(slice_s, slice_t)

diff_mean_s = mean_s - expected_mean_s
diff_mean_t = mean_t - expected_mean_t
diff_var_s = var_s - expected_var_s
diff_var_t = var_t - expected_var_t
diff_cov_st = cov_st - expected_cov_st

if which_process == 'bm':
    print 'T  = %11.7f' % T
elif which_process == 'bbbm' or which_process == 'bbsde':
    print 'X0 = %11.7f' % X0
k = len(Nis)

# Compute stratum weights
wis = [0.0] * k
for i in range(0, k):
	wis[i] = (1.0 * Nis[i]) / N

# Compute sample size n = sum_{i=1}^k w[i]*n[i]
n = 0
for i in range(0, k):
	n += wis[i] * nis[i]
n = int(n)

# Compute the simple and stratified means
mis = map(stats_m.find_mean, strata)
m = stats_m.find_mean(population)

# Compute the simple and stratified variances
vis = [0.0] * k
for i in range(0, k):
	vis[i] = stats_m.find_popvaraux(strata[i], mis[i])
v = stats_m.find_popvaraux(population, m)

# ----------------------------------------------------------------
if (1):
	print "N = %6d k = %6d m = %7.4f  v = %7.4f" % (N, k, m, v)

	if (N < 20):
		print
		for i in range(0, k):
			print "Stratum", i+1, " = ", strata[i]