Commit b8ed85c
Add Three Lectures on Long-term Risk and Learning (#889)
* Tom's May 8 edits of new lecture
* Tom's April 9 edits of new and old lectures
* Tom's addition of a lecture
* updates
* updates
* updates
* updates
* updates
* updates
* updates
* updates
* updates
* updates
* Update rng usage in lln_clt.md (#874)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix assorted issues in prob_meaning lecture (#878)
* Fix typos, spelling, notation errors, and swapped bounds in prob_meaning
- Fix spelling: probabilties, probabililty (x6), statististian
- Fix doubled word: "to to help"
- Fix variance formula: remove erroneous factor of n (rho is Bernoulli, not binomial)
- Fix notation: P_{k,i} → rho_{k,i} to match definition
- Fix subject-verb agreement: "means converges" → "mean converges"
- Fix swapped upper/lower bounds in part (e) ppf calls
- Fix compare() to include k=0
- Fix LaTeX: replace * with \cdot for multiplication
- Fix log(I) range: text said 2 to 7, code has 2 to 6
- Fix imprecise wording: f_k^I approximates Prob(X=k|θ), not θ
- Clarify vague exercise pm_ex1 part 3
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Improve code quality: naming, PEP 8, line length, grid resolution
- Rename class frequentist → Frequentist (PEP 8)
- Rename Bay_stat → bayes (snake_case for instances)
- Rename ii → i/post, num → n_obs, num_list → n_obs_list,
kk → k, K → head_counts, comp → table, step_num → n_obs,
npt → n_thetas, nn → n_ns, nI → n_Is
- Replace (sample <= θ) * 1 with .astype(int) for consistency
- Shorten docstrings to fit within 80 characters
- Break long code lines (plot calls, list comprehensions, titles)
- Increase θ grid from 100 to 1000 points for smoother density plots
- Use f-strings with comma formatting for plot labels
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Restructure Bayesian section: derive posterior before exercise
- Add back-reference to prob_matrix lecture for Bayes' Law intro
- Derive the n-step posterior Beta(α+k, β+n-k) before the exercise,
so the exercise solution code no longer precedes its own derivation
- Replace the duplicated derivation after the exercise with a concise
summary referencing the formula above
- Remove duplicate "Now pretend..." sentence before part (c)
- Replace "this quantecon lecture" cross-references with actual titles
for better PDF rendering
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Replace prettytable with pandas DataFrame in compare()
Drop the prettytable dependency — pandas is already imported and
renders nicely in Jupyter notebooks. The compare() method now returns
a DataFrame instead of printing a PrettyTable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Fix exercise pm_ex2 parts (a) and (b) to match their solutions
The question asked for the likelihood of "a sample of length n from
a binomial" but the solution gave the single-flip Bernoulli case.
Reword both the questions and solution headers so parts (a) and (b)
are explicitly about a single coin flip. The general n-step case is
already derived in the lecture text before the exercise.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add reproducible random seeds using modern NumPy API
Both classes now accept an rng parameter and use rng.random()
instead of np.random.rand(). Each code cell passes a seeded
np.random.default_rng() for reproducible output across builds.
Also remove "typically" from the hump-shape sentence, since with
fixed seeds the behavior is deterministic.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Clean up posterior PDF plots
- Rename title from "P.D.F" to "PDF"
- Simplify legend labels: "n = 0 (prior)", "n = 1", etc.
- Remove n = 30, 70, 300, 500 from observation list to reduce
clutter in the first PDF plot
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Remove repeated question text from exercise solutions
Solutions for parts (c)-(h) no longer duplicate the question text
as a header — they just use the part label. This follows the
QuantEcon convention.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Use p(θ) for density notation and break up solution derivation
- Change P(θ) to p(θ) throughout and note it is a density
- Replace the single aligned equation block in the solution for
part (b) with three separate display equations, each introduced
by explanatory text (Bayes' Law, substitution, collecting powers)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Final review polish: notation, plotting style, consistency
- Use **bold** instead of __bold__ for binomial distribution
- Use IID instead of i.i.d.
- Fix double "with" in exercise (c) wording
- Rename quantile variables from p_1/p_2 to q_1/q_2 to avoid
clash with p(θ) density notation
- Fix "means and variances statistics" → "mean and standard deviation"
- Standardize N → n in post-exercise text to match pre-exercise
- Update "exceeds 500" → "exceeds 1000" to match revised n_obs_list
- Standardize frequentist plots to use ax. methods instead of plt.
- Remove dead self.k assignment in Frequentist.binomial()
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Adopt new style guide notation conventions
Replace \textrm{Prob}(...) with \mathbb{P}{...} and E[...] with
\mathbb{E}[...] following QuantEcon.manual#84.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Update rng usage in stats_examples.md (#873)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* Tom's May 31 edits of long-run risk lecture
* updates
* updates
* updates
* updates
* updates
* updates
* Tom's June 5 edits of long run risk model
* update
---------
Co-authored-by: thomassargent30 <ts43@nyu.edu>1 parent d9ceae5 commit b8ed85c
7 files changed
Lines changed: 6385 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
| 207 | + | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
| |||
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
216 | | - | |
| 217 | + | |
| 218 | + | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
| |||
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
295 | | - | |
| 297 | + | |
| 298 | + | |
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
| |||
302 | 305 | | |
303 | 306 | | |
304 | 307 | | |
305 | | - | |
| 308 | + | |
| 309 | + | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
| |||
2133 | 2137 | | |
2134 | 2138 | | |
2135 | 2139 | | |
2136 | | - | |
2137 | | - | |
2138 | | - | |
2139 | | - | |
2140 | | - | |
2141 | | - | |
2142 | | - | |
2143 | | - | |
2144 | | - | |
2145 | | - | |
2146 | | - | |
2147 | 2140 | | |
2148 | 2141 | | |
2149 | 2142 | | |
| |||
2841 | 2834 | | |
2842 | 2835 | | |
2843 | 2836 | | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
2844 | 2884 | | |
2845 | 2885 | | |
2846 | 2886 | | |
| |||
3063 | 3103 | | |
3064 | 3104 | | |
3065 | 3105 | | |
3066 | | - | |
3067 | | - | |
3068 | | - | |
3069 | | - | |
3070 | | - | |
3071 | | - | |
3072 | | - | |
3073 | | - | |
3074 | | - | |
3075 | | - | |
3076 | | - | |
3077 | | - | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
3078 | 3114 | | |
3079 | 3115 | | |
3080 | 3116 | | |
3081 | | - | |
3082 | | - | |
3083 | | - | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
3084 | 3120 | | |
3085 | 3121 | | |
3086 | 3122 | | |
3087 | 3123 | | |
3088 | | - | |
| 3124 | + | |
| 3125 | + | |
3089 | 3126 | | |
3090 | 3127 | | |
3091 | 3128 | | |
| |||
3166 | 3203 | | |
3167 | 3204 | | |
3168 | 3205 | | |
3169 | | - | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
3170 | 3209 | | |
3171 | 3210 | | |
3172 | 3211 | | |
| |||
3859 | 3898 | | |
3860 | 3899 | | |
3861 | 3900 | | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
| 3912 | + | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
| 3932 | + | |
| 3933 | + | |
| 3934 | + | |
| 3935 | + | |
| 3936 | + | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
| 3945 | + | |
| 3946 | + | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
| 3961 | + | |
| 3962 | + | |
| 3963 | + | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
| 3974 | + | |
| 3975 | + | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
| 4010 | + | |
| 4011 | + | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
| 4057 | + | |
| 4058 | + | |
| 4059 | + | |
| 4060 | + | |
| 4061 | + | |
| 4062 | + | |
| 4063 | + | |
| 4064 | + | |
| 4065 | + | |
| 4066 | + | |
| 4067 | + | |
| 4068 | + | |
| 4069 | + | |
| 4070 | + | |
| 4071 | + | |
| 4072 | + | |
| 4073 | + | |
| 4074 | + | |
| 4075 | + | |
| 4076 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
| 149 | + | |
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | 267 | | |
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
272 | 271 | | |
273 | | - | |
| 272 | + | |
274 | 273 | | |
275 | 274 | | |
276 | 275 | | |
| |||
0 commit comments