<jupyter_start><jupyter_text>Create figures for paper<jupyter_code>%run requirements.ipynb<jupyter_output><empty_output><jupyter_text>**Section 4: An illustrative example: The logit-like demand function** Solve simple logit case with very simple settings (a lot of this is default, but just in case it's altered later on, we specify it here to make sure we can replicate figures):<jupyter_code>Settings = {'I': 1000,
            'alpha': 0.5,
            'lower': 0,
            'upper': 2,
            'eps': 0,
            'sample': 'ph_gh',
            'type': 'Logit',
            'n': 200,
            'loc': 200,
            'variance_p': 1,
            'variance_g': 1,
            'corr': 0,
            'seed': 30}
Logit = WCPV.Logit(name='Logit-like demand',**Settings) # Initialize
Logit.draw_sample()
Logit.solve_npv()
Logit.solve_fp()<jupyter_output>The solution converged.<jupyter_text>**Hourly Utility**<jupyter_code>fig,axes = Logit.plots(['plt_uhour'],titles={'plt_uhour': None},return_fig='Yes')
fig.savefig('Figs/Logit_uhour.pdf',edgecolor='k')<jupyter_output><empty_output><jupyter_text>Copy with increased $\overline{D}$:<jupyter_code>Logit_2 = WCPV.Logit(**Settings) # Initialize
Logit_2.upd_par({'lower': 0.5,
                 'upper': 3})
Logit_2.draw_sample()
Logit_2.solve_npv()
Logit_2.solve_fp()
fig,axes = Logit_2.plots(['plt_uhour'],titles={'plt_uhour': None},return_fig='Yes')
fig.savefig('Figs/Logit_uhour_v2.pdf',edgecolor='k')<jupyter_output>The solution converged.<jupyter_text>**Section 6: MNL** Plot utility with same settings as in 4, except for the type = MNL<jupyter_code>Settings['type']='MNL'
Settings['BP_Ref']='level'
MNLL = WCPV.Logit(name='mnl',**Settings)
MNLL.draw_sample()
MNLL.solve_npv()
MNLL.solve_fp()
fig,axes = MNLL.plots(['plt_uhour'],titles={'plt_uhour': None}, return_fig = 'Yes')
fig.savefig('Figs/MNLL_uhour.pdf',edgecolor='k')<jupyter_output><empty_output><jupyter_text>With share bliss point:<jupyter_code>Settings['BP_Ref'] = 'share'
MNLS = WCPV.Logit(**Settings)
MNLS.draw_sample()
MNLS.solve_npv()
MNLS.solve_fp()
fig,axes = MNLS.plots(['plt_uhour'],titles={'plt_uhour': None}, return_fig = 'Yes')
fig.savefig('Figs/MNLS_uhour.pdf',edgecolor='k')<jupyter_output><empty_output><jupyter_text>Plot MNLS with a higher level of yearly $E_t$. We do not have a straightforward plotting feature to do this, but we can 'cheat' us there, by manually updating the level 'MNLS.npv['E']' which refers to the yearly level with 'no price volatility' (npv):<jupyter_code>MNLS.npv['E'] = MNLS.npv['E']*1.5
fig,axes = MNLS.plots(['plt_uhour'],titles={'plt_uhour': None}, return_fig = 'Yes')
fig.savefig('Figs/MNLS_uhour_v2.pdf',edgecolor='k')<jupyter_output><empty_output><jupyter_text>Reset to obtain the right MNLS.npv['E'] again:<jupyter_code>MNLS.upd_all({}) # runs draw_sample(),solve_npv(),solve_fp() with new parameters (if any are parsed; otherwise the old values are retained)
fig,axes =Logit.plots(['plt_ph','plt_gh'],return_fig='Yes')
fig.savefig('Figs/Logit_sample.pdf',facecolor='#FAFAFA',edgecolor='k')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1626252828968639, 'fraction_numerical': 0.011639185257032008, 'mean_word_length': 5.814977973568282, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '598410', 'license': 'MIT', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1148, 'n_words': 218, 'path': 'CreateFigures.ipynb', 'repo_name': 'ChampionApe/WelfareCosts_PriceVolatility', 'size': '3093'}