Skip to content

Commit 29d801f

Browse files
jstacclaude
authored andcommitted
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>
1 parent 6c144a4 commit 29d801f

1 file changed

Lines changed: 211 additions & 259 deletions

File tree

0 commit comments

Comments
 (0)