<jupyter_start><jupyter_text>Replicate the spectral radius tables from the CRRA example<jupyter_code>from mp_model import MehraPrescott
import numpy as np
import pandas as pd
mp = MehraPrescott(γ=2.0)<jupyter_output><empty_output><jupyter_text>Check that the stationary mean and standard deviation line up:<jupyter_code>mp.ssd
mp.smean<jupyter_output><empty_output><jupyter_text>Here's the spectral radius at default values:<jupyter_code>mp.spec_rad_analytic()
mp.spec_rad_sim()<jupyter_output><empty_output><jupyter_text>Generate the table<jupyter_code>nvals = [200,  500, 600, 700, 800, 900, 1000]
mvals = [2000, 5000, 7500, 10000]
out = np.empty((len(mvals), len(nvals)))
for (i, n) in enumerate(nvals):
    for (j, m) in enumerate(mvals):
        out[j, i] = mp.spec_rad_sim(num_paths=m, ts_length=n)
out
df = pd.DataFrame(out)
df.columns = ["n = {}".format(n) for n in nvals]
df.index = ["m = {}".format(m) for m in mvals]
df
df.to_latex("out.tex")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1342828077314344, 'fraction_numerical': 0.04170905391658189, 'mean_word_length': 6.809523809523809, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '366052', 'license': 'MIT', 'n_tokens_mistral': 427, 'n_tokens_neox': 380, 'n_words': 89, 'path': 'mehra_prescott_code_asset_pricing/.ipynb_checkpoints/mehra_prescott_spec_rad_tables-checkpoint.ipynb', 'repo_name': 'jngod2011/asset_pricing_code', 'size': '983'}