Skip to content

fix: review findings for montecarlo/03_mc_compare.R#25

Open
Davidvandijcke wants to merge 3 commits intomainfrom
fix/review-montecarlo-03_mc_compare
Open

fix: review findings for montecarlo/03_mc_compare.R#25
Davidvandijcke wants to merge 3 commits intomainfrom
fix/review-montecarlo-03_mc_compare

Conversation

@Davidvandijcke
Copy link
Copy Markdown
Owner

Automated fixes from code review pipeline.

Davidvandijcke and others added 3 commits March 5, 2026 00:57
…scope, saving CI)

S1:  Fix double-dereference ``fuzzy'' / ``weights'' -> `fuzzy' / `weights'
S7:  Read r(pilot_den) and r(h_den) into locals immediately after Mata call
     before intervening commands can clear r() results
S8:  Track Mata loading success via local mata_loaded instead of ambient _rc
S18: Remove redundant tempvar drops in r3d_bwselect.ado
S21: saving() now writes bootstrap CB bounds instead of pointwise normal CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- F1: remove dead `rej_label` assignment (never used)
- F2: guard `sink(tex_file)` with `on.exit(sink(), add = TRUE)` to prevent stdout leak on error
- F3: initialise all metric variables to NA at top of innermost loop body to prevent stale-value emission
- F4: remove `delta > 0` filter from coverage check so delta=0 under-coverage is also detected
- F5: pre-allocate diff vectors with `numeric(N_STATA)` and assign by index instead of growing with `c()` (O(n) vs O(n²))
- F6: add guard after loading `r_res` to skip cells with missing required fields and emit a diagnostic message

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant