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]:
0.9980441894470401

In [6]:
f = mc_factory(by, I=D, J=D)

Test function


In [7]:
f()


Out[7]:
0.9981533494790092

In [8]:
f()


Out[8]:
0.998129786740234

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()


Calculating n=750, m=6000
Calculating n=750, m=8000
Calculating n=750, m=10000
Calculating n=750, m=12000
Calculating n=750, m=14000
Calculating n=1000, m=6000
Calculating n=1000, m=8000
Calculating n=1000, m=10000
Calculating n=1000, m=12000
Calculating n=1000, m=14000

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)


\begin{table}
\centering
\begin{tabular}{llll}
    & m = 6000 & m = 8000 & m = 10000 & m = 12000 & m = 14000 \\
\hline \hline
n = 750 & 0.998117 & 0.998113 & 0.998112 & 0.998106 & 0.998109 \\
         & (0.000031) & (0.000032) & (0.000035) & (0.000027) & (0.000028) \\
\hline
n = 1000 & 0.998106 & 0.998113 & 0.998109 & 0.998108 & 0.998111 \\
         & (0.000029) & (0.000023) & (0.000031) & (0.000031) & (0.000030) \\
\hline

\end{tabular}
\end{table}


In [ ]:


In [ ]:


In [ ]: