Fix assorted issues in prob_meaning lecture#878
Merged
Conversation
- 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>
- 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>
- 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>
Contributor
Author
|
This PR addresses the issues catalogued in #877. The changes are split across three commits for easier review:
|
21 tasks
📖 Netlify Preview Ready!Preview URL: https://pr-878--sunny-cactus-210e3e.netlify.app Commit: 📚 Changed LecturesBuild Info
|
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>
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>
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>
- 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>
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>
- 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>
- 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>
14 tasks
Contributor
Author
|
Note: If QuantEcon/QuantEcon.manual#84 is merged (which standardizes on |
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>
Contributor
Author
|
Please let me know if you would like any modifications to the PR. I'll aim to merge tomorrow but we can always walk things backwards. I think these are all good changes. |
4 tasks
thomassargent30
pushed a commit
that referenced
this pull request
May 31, 2026
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #877 — a comprehensive revision of
lectures/prob_meaning.md.Mechanical fixes:
*→\cdotcompare()now includes**bold**instead of__bold__Code quality:
frequentist→Frequentist,Bay_stat→bayes)ii→post/i,kk→k,K→head_counts, etc.)np.random.default_rng()seeds (modern NumPy API)ax.methods instead ofplt.self.kassignmentContent restructuring:
prob_matrixlecture for Bayes' LawTest plan
🤖 Generated with Claude Code