Skip to content

g3_fit: Add f_by_age argument for the age range of F - #53

Merged
willbutler42 merged 1 commit into
mainfrom
g3_fit-f_by_age
Oct 22, 2026
Merged

willbutler42 merged 1 commit into
mainfrom
g3_fit-f_by_age

Conversation

@willbutler42

Copy link
Copy Markdown
Collaborator

Addresses #52.

  • Documents that res.by.year$F (and f.by.year$F) is by default the F of the oldest age of each stock.
  • Adds f_by_age to g3_fit(): NULL (default, oldest age), an age range for all stocks (e.g. c(4, 7)), or a named list per stock (e.g. list(imm = c(1, 2), mat = c(5, 6))). F is NA, with a warning, for stocks with no ages in the range.
  • F at age is the per-step -log(1 - C/N) summed over the steps of the year, then the unweighted mean over the age range.

The default output is unchanged. Checked on two test models (equal and unequal step lengths, two areas): f.by.year and res.by.year are identical to main, and F for each f_by_age option matches a calculation straight from the report arrays.

@MikkoVihtakari could you test this?

🤖 Generated with Claude Code

By default res.by.year$F is the F of the oldest age of each stock,
which is now documented. f_by_age sets the age range (for all stocks,
or per stock as a named list). F at age is the sum of the per-step
-log(1 - C/N) over the year, then averaged (unweighted) over the ages.

Closes #52

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MikkoVihtakari

Copy link
Copy Markdown
Collaborator

I don't have time to test it in a branch. If you merge it into the main branch, we can test it as we work. If there are bugs, we'll report them.

@willbutler42
willbutler42 merged commit 3667a21 into main Oct 22, 2026
1 check passed
@MikkoVihtakari
MikkoVihtakari deleted the g3_fit-f_by_age branch October 22, 2026 12:23
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.

2 participants