Skip to content

Selfreport - #11

Open
ericward-noaa wants to merge 4 commits into
mainfrom
selfreport
Open

Selfreport#11
ericward-noaa wants to merge 4 commits into
mainfrom
selfreport

Conversation

@ericward-noaa

Copy link
Copy Markdown
Owner

No description provided.

ericward-noaa and others added 4 commits July 28, 2026 08:41
Added self-reporting probability sub-model inputs and validation checks to fit_bycatch function. Enhanced data aggregation for self-reporting vessels.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for self-reporting as an additional monitoring stream in fit_bycatch(), including an optional Stan sub-model to estimate (with posterior uncertainty) the probability that monitored vessels also self-report, and uses that to adjust expansion effort to avoid double-counting coverage.

Changes:

  • Introduces a 4th “self-report” stream (takes_selfreport / effort_selfreport) alongside obs/em/both in fit_bycatch().
  • Adds an optional binomial sub-model (covrate_selfreport + vessels_observed) to estimate pooled p_report and adjust expansion effort in generated quantities.
  • Updates Rd documentation/examples and adjusts roxygen metadata in DESCRIPTION.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
R/fitting.R Adds self-report stream inputs, validation, and yearly aggregation for self-report probability sub-model Stan data.
inst/stan/bycatch.stan Extends the Stan model with a self-report stream likelihood plus a pooled p_report sub-model and expansion-effort adjustment.
man/fit_bycatch.Rd Documents new parameters and adds a self-report usage example; fixes rstan link targets.
DESCRIPTION Updates roxygen-related metadata (removes RoxygenNote, adds Config/roxygen2/version).
Files not reviewed (1)
  • man/fit_bycatch.Rd: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/fitting.R
Comment on lines +28 to +38
if (estimate_self_report) {
row_n_observed <- data[[vessels_observed]]
row_n_self_report <- round(data[[covrate_selfreport]] / 100 * row_n_observed)

for (i in seq_len(nrow(data))) {
t <- time_idx[i]
n_vessels_observed[t] <- n_vessels_observed[t] + row_n_observed[i]
n_vessels_self_report[t] <- n_vessels_self_report[t] + row_n_self_report[i]
}
cli_inform("Self-report sub-model: {sum(n_vessels_observed)} observed vessels, {sum(n_vessels_self_report)} implied self-reporters")
}
Comment thread R/fitting.R
Comment on lines +290 to +295
if (!is.null(covrate_selfreport)) {
if (any(data[[covrate_selfreport]] < 0 | data[[covrate_selfreport]] > 100, na.rm = TRUE)) {
stop("covrate_selfreport must be a percentage between 0 and 100")
}
}

Comment thread R/fitting.R
Comment on lines +269 to +276
# Validate self-report stream inputs (a 4th stream, like em/both)
if (!is.null(takes_selfreport) && is.null(effort_selfreport)) {
stop("If takes_selfreport is provided, effort_selfreport must also be provided")
}
if (!is.null(effort_selfreport) && is.null(takes_selfreport)) {
stop("If effort_selfreport is provided, takes_selfreport must also be provided")
}

Comment thread inst/stan/bycatch.stan
Comment on lines +786 to +792
for(t in 1:n_year) {
real expected_overlap = 0;
if(estimate_self_report == 1) {
expected_overlap = p_report[t] * effort_monitored_by_year[t];
}
effort_selfreport_new_coverage[t] = fmax(effort_selfreport_by_year[t] - expected_overlap, 0);
new_effort_adjusted[t] = fmax(new_effort_by_year[t] - effort_selfreport_new_coverage[t], 0);
Comment thread DESCRIPTION
Comment on lines 44 to +49
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
SystemRequirements: GNU make
Biarch: true
Config/testthat/edition: 3
Config/roxygen2/version: 8.0.0
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