From 5dd5e0337fb211fed54cce480147a643d22525c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Apr 2026 01:32:42 +0000 Subject: [PATCH 1/3] Fix grammar in planetary_motion.R lines 825-827 Remove extra "the" before "after" and add missing article "a" before "need". --- planetary_motion/planetary_motion.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/planetary_motion/planetary_motion.R b/planetary_motion/planetary_motion.R index 5748ba6..639e65f 100644 --- a/planetary_motion/planetary_motion.R +++ b/planetary_motion/planetary_motion.R @@ -822,9 +822,9 @@ ppc_plot2D(fit2p, data_pred = data_pred, plot_star = TRUE) #' #' The Pathfinder algorithm can be used to find many modes and obtain #' approximate posterior draws. If the Pareto-$\hat{k}$ diagnostic for -#' the Pathfinder approximation looks good, then the after the +#' the Pathfinder approximation looks good, then after the #' importance sampling those draws would be good enough and there -#' would not be need to run MCMC. Pathfinder provides a great way to +#' would not be a need to run MCMC. Pathfinder provides a great way to #' fit and fail fast. Further posterior draws can be obtained using #' MCMC with Pathfinder initialization. #' From f0d4b093b3c2113df3abfd8ca1f519092857c13d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Apr 2026 01:40:40 +0000 Subject: [PATCH 2/3] Fix clear typos and grammar issues across repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applied unambiguous fixes found during a full repo scan: - roaches.R: remove doubled "to to" (2 occurrences) - park_rule.R: remove doubled "the the" - sleep_study.R: "an hierarchical" → "a hierarchical" - kilpis_ppc.R: "an weakly" → "a weakly" - sbc.R: "want to/be able to" → "want to or be able to" - birthdays.R: remove 4 double-spaces in comments, fix subject-verb agreement ("parameters are"), missing article ("a bad model"), and word ("trying to get") - Add grammar_issues.md with 5 ambiguous issues for human review --- birthdays/birthdays.R | 8 +-- grammar_issues.md | 76 ++++++++++++++++++++++ misc/chapter_08/section_08_02/kilpis_ppc.R | 2 +- park_rule/park_rule.R | 2 +- roaches/roaches.R | 4 +- sbc/sbc.R | 2 +- sleep_study/sleep_study.R | 2 +- 7 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 grammar_issues.md diff --git a/birthdays/birthdays.R b/birthdays/birthdays.R index fabe85c..1d042bc 100644 --- a/birthdays/birthdays.R +++ b/birthdays/birthdays.R @@ -626,7 +626,7 @@ compose_3panel(pf, pf1, pf2) #' Seasonal component has reasonable fit to the data. #' -#' Compare the mean and sd of parameters from Pathfinder and MCMC. +#' Compare the mean and sd of parameters from Pathfinder and MCMC. #| label: fig-births-pth2-vs-fit2 variables <- names(model2$variables()$parameters) sp <- summarise_draws(subset(pdraws2, variable = variables)) @@ -748,7 +748,7 @@ compose_4panel(pf, pf1, pf2, pf3) #' Weekday effects are easy to estimate as there are about thousand #' observations per weekday. #' -#' Compare the mean and sd of parameters from Pathfinder and MCMC. +#' Compare the mean and sd of parameters from Pathfinder and MCMC. #| label: fig-births-pth3-vs-fit3 variables <- names(model3$variables()$parameters) sp <- summarise_draws(subset(pdraws3, variable = variables)) @@ -883,7 +883,7 @@ compose_4panel(pf, pf1, pf2, pf3b) #' relative number of births, that is, it is able to model the #' increasing weekend effect. #' -#' Compare the mean and sd of parameters from Pathfinder and MCMC. +#' Compare the mean and sd of parameters from Pathfinder and MCMC. #| label: fig-births-pth4-vs-fit4 variables <- names(model4$variables()$parameters) sp <- summarise_draws(subset(pdraws4, variable = variables)) @@ -1113,7 +1113,7 @@ compose_6panel(pf, pf1, pf2, pf3, pf2b) #' Compare the mean and sd of parameters from Pathfinder and #' MCMC. In this case, we are using the non-resampled Pathfinder draws #' (the resampled draws had only one distinct draw). -#' Compare the mean and sd of parameters from Pathfinder and MCMC. We see that MCMC estimates of sd for some parameters is super high, indicating bad model. Instead of trying the get the computation work better, we drop this model at the moment. +#' Compare the mean and sd of parameters from Pathfinder and MCMC. We see that MCMC estimates of sd for some parameters are super high, indicating a bad model. Instead of trying to get the computation to work better, we drop this model at the moment. #| label: fig-births-pth5-vs-fit5 variables <- names(model5$variables()$parameters) sp <- summarise_draws(subset(pth5$draws(), variable = variables)) diff --git a/grammar_issues.md b/grammar_issues.md new file mode 100644 index 0000000..6d12147 --- /dev/null +++ b/grammar_issues.md @@ -0,0 +1,76 @@ +# Grammar and Typo Issues Requiring Human Review + +The following issues were found during a repository-wide grammar scan. They are ambiguous enough that an automated fix could alter the intended meaning, and require an author to resolve. + +--- + +## 1. `nabiximols/nabiximols.R` — Line 154 + +**Current text:** +> The second provided models is binomial model with the number of trials being $28$ for each outcome (`cu`) + +**Issues:** "models" should likely be "model" (plural → singular), and "binomial model" is missing the article "a". + +**Suggested fix:** +> The second provided model is a binomial model with the number of trials being $28$ for each outcome (`cu`) + +--- + +## 2. `roaches/roaches.R` — Line 394 + +**Current text:** +> there would not have been need to fit Poisson model at all. + +**Issues:** Missing article and awkward phrasing. The intended meaning is unclear — "been a need" or "been needed". + +**Option A:** +> there would not have been a need to fit the Poisson model at all. + +**Option B:** +> there would not have needed to fit the Poisson model at all. + +--- + +## 3. `golf/golf.R` — Line 694 + +**Current text:** +> because it was a sort of admission of failure to not be able to directly use the binomial model. + +**Issue:** Double negative — "failure to not be able to" is contradictory. The intended meaning determines the fix. + +**Option A** (failure = couldn't use binomial): +> because it was a sort of admission of failure to directly use the binomial model. + +**Option B** (failure = the workaround itself): +> because it was a sort of admission that we were not able to directly use the binomial model. + +--- + +## 4. `birthdays/birthdays.R` — Line 308 + +**Current text:** +> and in this that number is impractically big. + +**Issue:** "in this that" is garbled — a word is missing or misplaced. + +**Suggested fix (uncertain which word was intended):** +> and in this case the number is impractically big. + +or + +> and in that case the number is impractically big. + +--- + +## 5. `nabiximols/nabiximols.R` — Line 1084 + +**Current text:** +> which makes the log score not to be sensitive in tails. + +**Issue:** "not to be sensitive" is awkward. The intended meaning could be "insensitive" or "not sensitive". + +**Option A:** +> which makes the log score insensitive in the tails. + +**Option B:** +> which makes the log score not sensitive in the tails. diff --git a/misc/chapter_08/section_08_02/kilpis_ppc.R b/misc/chapter_08/section_08_02/kilpis_ppc.R index 0c94b26..d622bf0 100644 --- a/misc/chapter_08/section_08_02/kilpis_ppc.R +++ b/misc/chapter_08/section_08_02/kilpis_ppc.R @@ -63,7 +63,7 @@ data_lin <- data.frame(year = data_kilpis$year, #' In this case, we are happy with the default prior for the #' intercept. In this specific case, the flat prior on coefficient is -#' also fine, but we add an weakly informative prior just for the +#' also fine, but we add a weakly informative prior just for the #' illustration. Let's assume we expect the temperature to change less #' than 1°C in 10 years. With `student_t(3, 0, 0.03)` about 95% prior #' mass has less than 0.1°C change in year, and with low degrees of diff --git a/park_rule/park_rule.R b/park_rule/park_rule.R index 526f3d7..970c31b 100644 --- a/park_rule/park_rule.R +++ b/park_rule/park_rule.R @@ -263,7 +263,7 @@ print(fit_1) fit_1$sampler_diagnostics() |> as_draws_rvars() #' We are specifically interested in how efficient each Hamiltonian -#' Monte Carlo iteration is. This can be measured by the the number of +#' Monte Carlo iteration is. This can be measured by the number of #' leapfrog steps `n_leapfrog__`, which is close to the number of log #' density and gradient evaluations. Instead of examining #' `n_leapfrog__` directly, it is common to examine `treedepth__` as diff --git a/roaches/roaches.R b/roaches/roaches.R index 3101ed7..f9bffae 100644 --- a/roaches/roaches.R +++ b/roaches/roaches.R @@ -479,7 +479,7 @@ fit_pvi <- add_criterion(fit_pvi, criterion = "loo") loo(fit_pvi) #' `p_loo` is about 164, which is less than the number of parameters -#' 267, but it is relatively large compared to to the number of +#' 267, but it is relatively large compared to the number of #' observations (`p_loo >>N/5`), which indicates very flexible #' model. In this case, this is due to having an intercept parameter for #' each observation. Removing one observation changes the posterior @@ -817,7 +817,7 @@ autoplot(rd) + #' be see in LOO-PIT values. Both negative-binomial and zero-inflated #' negative binomial are close enough the LOO-PIT can't see #' discrepancy from the data, but elpd_loo and calibration plot were -#' able to to show that zero-inflation component improves the +#' able to show that zero-inflation component improves the #' predictive accuracy and calibration. #' #' ## Analyse posterior diff --git a/sbc/sbc.R b/sbc/sbc.R index 480a69d..efdd2d6 100644 --- a/sbc/sbc.R +++ b/sbc/sbc.R @@ -759,7 +759,7 @@ combined_ranks / combined_ecdf #' divergences, but just to complete our tour of possibilities, we'll #' show one more option to dealing with this type of problem. #' -#' The general idea is that although we might not want to/be able to +#' The general idea is that although we might not want to or be able to #' express our prior belief about the model (here that the two mixture #' components are distinct) by priors on model parameters, we still #' may be able to express our prior belief about the data itself. diff --git a/sleep_study/sleep_study.R b/sleep_study/sleep_study.R index 189e6ab..d1e0452 100644 --- a/sleep_study/sleep_study.R +++ b/sleep_study/sleep_study.R @@ -614,7 +614,7 @@ loo(fit4, fit5) #' - In theory, we would not need the #' exponential link on sigma but then we had to care for the positivity of the #' varying intercepts on sigma and hence would have to specify, for example, an -#' hierarchical Gamma rather than an hierarchical normal prior. +#' hierarchical Gamma rather than a hierarchical normal prior. #' - Look at prior predictions for the correlations to demonstrate #' the effect of the LKJ prior for larger than 2x2 matrices #' From f62d2e8d7046fab5746ea6d9b382ae39fb0f3d29 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Apr 2026 22:40:27 +0000 Subject: [PATCH 3/3] Apply reviewer-approved grammar fixes and remove grammar_issues.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per jgabry's review on avehtari/Bayesian-Workflow#13: - nabiximols.R:154: "models is binomial model" → "model is a binomial model" - roaches.R:394: "not have been need" → "not have been a need to fit the Poisson model" - birthdays.R:308: "in this that number" → "in this case the number" - nabiximols.R:1084: "not to be sensitive in tails" → "not sensitive in the tails" - golf.R:694: left as-is per reviewer request - Remove grammar_issues.md --- birthdays/birthdays.R | 2 +- grammar_issues.md | 76 ----------------------------------------- nabiximols/nabiximols.R | 4 +-- roaches/roaches.R | 2 +- 4 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 grammar_issues.md diff --git a/birthdays/birthdays.R b/birthdays/birthdays.R index 1d042bc..bc197cc 100644 --- a/birthdays/birthdays.R +++ b/birthdays/birthdays.R @@ -305,7 +305,7 @@ ldraws1 |> #' Here `khat` is larger than 0.7 indicating that importance sampling #' even with Pareto smoothing is not able to provide accurate #' adjustment. `min_ss` indicates how many draws would be needed to -#' get an accurate importance weighting adjustment, and in this that +#' get an accurate importance weighting adjustment, and in this case the #' number is impractically big. Even the Laplace approximation can be #' useful, this diagnostic shows that we would eventually want to run #' MCMC for more accurate inference. diff --git a/grammar_issues.md b/grammar_issues.md deleted file mode 100644 index 6d12147..0000000 --- a/grammar_issues.md +++ /dev/null @@ -1,76 +0,0 @@ -# Grammar and Typo Issues Requiring Human Review - -The following issues were found during a repository-wide grammar scan. They are ambiguous enough that an automated fix could alter the intended meaning, and require an author to resolve. - ---- - -## 1. `nabiximols/nabiximols.R` — Line 154 - -**Current text:** -> The second provided models is binomial model with the number of trials being $28$ for each outcome (`cu`) - -**Issues:** "models" should likely be "model" (plural → singular), and "binomial model" is missing the article "a". - -**Suggested fix:** -> The second provided model is a binomial model with the number of trials being $28$ for each outcome (`cu`) - ---- - -## 2. `roaches/roaches.R` — Line 394 - -**Current text:** -> there would not have been need to fit Poisson model at all. - -**Issues:** Missing article and awkward phrasing. The intended meaning is unclear — "been a need" or "been needed". - -**Option A:** -> there would not have been a need to fit the Poisson model at all. - -**Option B:** -> there would not have needed to fit the Poisson model at all. - ---- - -## 3. `golf/golf.R` — Line 694 - -**Current text:** -> because it was a sort of admission of failure to not be able to directly use the binomial model. - -**Issue:** Double negative — "failure to not be able to" is contradictory. The intended meaning determines the fix. - -**Option A** (failure = couldn't use binomial): -> because it was a sort of admission of failure to directly use the binomial model. - -**Option B** (failure = the workaround itself): -> because it was a sort of admission that we were not able to directly use the binomial model. - ---- - -## 4. `birthdays/birthdays.R` — Line 308 - -**Current text:** -> and in this that number is impractically big. - -**Issue:** "in this that" is garbled — a word is missing or misplaced. - -**Suggested fix (uncertain which word was intended):** -> and in this case the number is impractically big. - -or - -> and in that case the number is impractically big. - ---- - -## 5. `nabiximols/nabiximols.R` — Line 1084 - -**Current text:** -> which makes the log score not to be sensitive in tails. - -**Issue:** "not to be sensitive" is awkward. The intended meaning could be "insensitive" or "not sensitive". - -**Option A:** -> which makes the log score insensitive in the tails. - -**Option B:** -> which makes the log score not sensitive in the tails. diff --git a/nabiximols/nabiximols.R b/nabiximols/nabiximols.R index 8b393ce..103ba5a 100644 --- a/nabiximols/nabiximols.R +++ b/nabiximols/nabiximols.R @@ -151,7 +151,7 @@ fit_normal <- brm(formula = cu ~ group*week + (1 | id), fit_normal <- add_criterion(fit_normal, criterion = "loo", save_psis = TRUE, moment_match = TRUE) -#' The second provided models is binomial model with the number of +#' The second provided model is a binomial model with the number of #' trials being $28$ for each outcome (`cu`) #| label: fit_binomial #| results: hide @@ -1081,7 +1081,7 @@ loo_compare(fit_betabinomial2b, fit_betabinomial3b) #' for a new 4-week period is big, that is the predictive #' distribution is very wide and due to the constrained range #' has also thick tails (actually U shape), which makes the log -#' score not to be sensitive in tails. +#' score not sensitive in the tails. #' #' As the predictive distribution is wide with thick tails, we can #' also focus on comparing absolute error of using means of the diff --git a/roaches/roaches.R b/roaches/roaches.R index f9bffae..396a821 100644 --- a/roaches/roaches.R +++ b/roaches/roaches.R @@ -391,7 +391,7 @@ loo_compare(list(`Poisson` = loo_p1, `Neg-bin` = loo_nb1)) #' cross validation model comparison, we could have also seen that #' Poisson is not a good model by looking at the posterior of the #' over-dispersion parameter (which gets very small values), and there -#' would not have been need to fit Poisson model at all. +#' would not have been a need to fit the Poisson model at all. #| label: fig-posterior-nb_dispersion #| fig-height: 2 #| fig-width: 6