Skip to content

Add Figure 4 yield-management analyses to manuscript vignette - #32

Open
ANAMASGARD wants to merge 3 commits into
PecanProject:mainfrom
ANAMASGARD:fix/issue-25-manuscript-figure-4
Open

Add Figure 4 yield-management analyses to manuscript vignette#32
ANAMASGARD wants to merge 3 commits into
PecanProject:mainfrom
ANAMASGARD:fix/issue-25-manuscript-figure-4

Conversation

@ANAMASGARD

@ANAMASGARD ANAMASGARD commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the minimum requested Figure 4 analyses to the manuscript vignette:

  • Figure 4(a): yield response to nitrogen fertilization rate
  • Figure 4(d): yield response to stand age
  • Coverage summaries by panel and genus
  • Descriptive ordinary least-squares regression summaries

The implementation links yield observations to management records through the managements_treatments bridge table and reduces management data to one analysis-ready row per treatment before joining.

Data handling

  • Uses traitsview yield records for Miscanthus and Panicum
  • Converts nitrogen rates from g m-2 y-1 to kg ha-1 y-1
  • Collapses repeated identical nitrogen-rate records
  • Excludes treatments with conflicting nitrogen rates instead of arbitrarily
    selecting, summing, or averaging them
  • Uses the earliest valid planting date to calculate stand age
  • Rejects negative stand ages
  • Verifies that management joins do not duplicate yield observations
  • Uses coord_cartesian() for manuscript-like display limits while retaining
    valid observations in the regression models

The vignette also explains that these are descriptive regressions using the
current public betydata snapshot and are not claimed to exactly reproduce the
historical mixed-model results from the manuscript.

Related Issue(s)

Closes #25

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Checklist

  • I have updated documentation if applicable
  • I have added/updated tests if applicable

Validation

  • quarto::quarto_render("vignettes/manuscript.qmd")
    • All 25 chunks rendered
    • HTML output generated successfully
  • devtools::test()
    • 19 passed
    • 0 failures
    • 0 warnings
    • 0 skipped
  • Clean temporary package installation passed
  • Package build passed
  • R CMD check --no-vignettes --no-manual
    • Installation, namespace, syntax, examples, and tests passed
  • git diff --check passed
  • Only vignettes/manuscript.qmd was modified

A Quarto panel-layout warning remains during direct rendering:

Panel layout for fig-yield-management has no content

The HTML is still generated and the two plots render, but this warning should be reviewed as part of the PR.

Data Changes

Not applicable. This PR does not modify packaged datasets or files under data-raw/.

Screenshots

Local validation

Screenshot From 2026-07-16 22-36-50

Rendered Figure 4

Screenshot From 2026-07-16 23-03-45 --- Screenshot From 2026-07-16 23-07-05

Additional Notes

The Figure 4 scope is limited to the explicitly requested panels (a) and (d). Precipitation and growing-degree-day panels are outside this PR.

dlebauer

This comment was marked as duplicate.

@dlebauer dlebauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a very nice improvement, thank you for taking the time to implement these analyses!

The requested panels and tables render successfully, but the OLS statistical model treats repeated observations within treatments and sites as independent, although they are not. The original analysis used site/year random effects.

Specifically, please apply the original, hierarchical statistical models used in https://github.com/ebimodeling/betydb_manuscript/blob/master/gcbb_manuscript.Rmd, e.g. see pavi_re and misp_re models starting on line 867. There were some OLS regressions in that document, but those were just to compare model fits and were not presented as results. Please use these species-level random effects models to calculate the statistics and show the lines in the plots. You should be able to copy-paste the relevant code used for fitting, plotting, and statistical summaries. You may use different R packages, provided it implements the same model structure and produces equivalent statistical summaries and fitted lines.

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.

Add plots to manuscript vignette

2 participants