Skip to content

statistical interpretation in report_assessment#568

Merged
annelaerkes merged 1 commit into
osparcomm:developfrom
RobFryer:report_assessmnt_1
Jul 6, 2026
Merged

statistical interpretation in report_assessment#568
annelaerkes merged 1 commit into
osparcomm:developfrom
RobFryer:report_assessmnt_1

Conversation

@RobFryer

@RobFryer RobFryer commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

See #566.
The statistical interpretation in report_assessment is too simplistic when a smooth model is selected. This is because the model is selected by AICc so p_overall_trend is not necessarily 'significant' at the 5% level. However, in such cases, the existing text just says that there is no significant trend in the data.

The statistical interpreation is now more nuanced, saying that there is strong (p < 0.01), moderate (p < 0.05) or weak (p >= 0.05) evidence of a trend in the time series (depending on the value of p_overall_trend). Note that weak could include a p-value as high as 0.15 if a smooth on 2 df is selected and there are lots of years and the improvement in AICc over the mean model is marginal.

Have made the interpretation of imposex change point models similarly nuanced.

(The code behind the statistical interpretation could be streamlined considerably, but not this time!)

Tested on many time series from the OSPAR 2026 assessment.

@RobFryer

RobFryer commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

@hallareinert following on from our discussion about logicals the other day, using isTRUE is really good when you have a logical passed in by the user (because they could put anything in the function call). However, if the logical x is explicitly constructed within the function, then I think it is sufficient to just write if (x). You wouldn't write if (a > 5 == TRUE), just if (a > 5), so in the same way you would write if (x) rather than if (x == TRUE). Hope this makes sense.

trend_description,
"Higher values of",
info$det_name,
"indicate healthier organisms, so the trend suggests a",

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.

small thing, but suggestion: include the articles "a" and "an" in the if statement:
"so the trend suggests",
if (wk$overall_change > 0) "an improving" else "a deteriorating",

@hallareinert hallareinert 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.

a tiny suggestion on line 1067, otherwise good as far as I'm aware

@annelaerkes annelaerkes 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.

I am confused about the revised comment and how it links to the code. The text suggests to me that the level of the significance in the comment refers to the smoother model but the code suggests to me that it refers to the log-linear overall trend? Can this be clarified in the comments? Maybe I misunderstand how the smoother trend and overall trend is connected?

 # these models have evidence of non-linearity (in one form or another) by
  # virtue of being selected by AIC or AICc; however, the level of significance
  # might be > 0.05

  if (wk$p_overall_trend < 0.01) {
    sig_strength <- "strong"
  } else if (wk$p_overall_trend < 0.05) {
    sig_strength <- "moderate"

@annelaerkes annelaerkes merged commit cc1aabf into osparcomm:develop Jul 6, 2026
1 check passed
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.

3 participants