In [1]:
%run src/by_discretized_test.py
In [2]:
import pandas as pd
import matplotlib.pyplot as plt
In [3]:
by = BY()
In [4]:
D=4
In [5]:
test_val_spec_rad(by, I=D, J=D)
Out[5]:
In [6]:
f = mc_factory(by, I=D, J=D)
Test function
In [7]:
f()
Out[7]:
In [8]:
f()
Out[8]:
In [24]:
n_vals = np.array([750, 1000])
m_vals = np.array([6000, 8000, 10000, 12000, 14000])
In [25]:
k = 500
draws = np.empty(k)
means = np.empty((len(n_vals), len(m_vals)))
stds = np.empty((len(n_vals), len(m_vals)))
for n_i, n in enumerate(n_vals):
for m_i, m in enumerate(m_vals):
print(f'Calculating n={n}, m={m}')
for i in range(k):
draws[i] = f(n=n, m=m)
means[n_i, m_i] = draws.mean()
stds[n_i, m_i] = draws.std()
In [26]:
means_strings = means.round(6).astype(str)
n_strings = n_vals.astype(str)
start_table = r"""
\begin{table}
\centering
\begin{tabular}{llll}
"""
m_table = ' & m = '.join(m_vals.astype(str))
m_table = ' & m = ' + m_table + r' \\' + '\n' + r'\hline \hline' '\n'
end_table = r"""
\end{tabular}
\end{table}
"""
row_string = ''
for row in range(len(n_strings)):
temp_means = ' & '.join(means_strings[row, :])
x = ['{:f}'.format(item) for item in stds[row, :]]
temp_stds = '(' + ') & ('.join(x) + ')'
row_string += f'n = {n_strings[row]} & ' + temp_means + r' \\' + '\n'
row_string += ' & ' + temp_stds + r' \\' + '\n'
row_string += r'\hline' '\n'
print(start_table + m_table + row_string + end_table)
In [ ]:
In [ ]:
In [ ]: