emergence_calc: Core Emergence-Period Calculation (Stage-Grading Method)

View source: R/emergence_calc.R

emergence_calcR Documentation

Core Emergence-Period Calculation (Stage-Grading Method)

Description

Computes the emergence-period projection from one field survey of the population stage structure (the classic Chinese stage-grading method, fen ling fen ji tui suan fa). The stages are ordered by their days to eclosion (most developed first), the cumulative development share is built top-down and the eclosion dates of the requested quantiles — by default 16 (beginning), 50 i.e. the mean +/- 1 SD of a normal emergence curve) — are obtained by linear interpolation of the days-to-eclosion axis, then anchored to the survey date. When pre_ovip / egg_days are supplied, the larval hatch dates are projected as well (eclosion + pre-oviposition period + egg duration).

Usage

emergence_calc(
  data,
  stage_col = NULL,
  count_col = NULL,
  percent_col = NULL,
  days_col = NULL,
  survey_date,
  p = c(0.16, 0.5, 0.84),
  labels = NULL,
  pre_ovip = 0,
  egg_days = 0
)

Arguments

data

A data.frame with a stage column (character), a count or percent column (numeric) and a days column: the average days from that stage to adult eclosion at the current temperature.

stage_col, count_col, percent_col, days_col

Column names; auto-detected by default (English and Chinese aliases, e.g. stage / count / days or their Chinese equivalents). Exactly one of count / percent is required.

survey_date

The survey date: a Date or a character string ("2026-03-20", "2026/3/20").

p

Numeric vector of emergence quantiles, default c(0.16, 0.5, 0.84).

labels

Optional labels of the quantiles (same length as p); NULL (default) uses ‘⁠Beginning (16%)⁠’ etc. for the default p, or ‘⁠16%⁠’-style labels otherwise.

pre_ovip

Pre-oviposition period in days (default 0 = not used).

egg_days

Egg duration in days (default 0 = not used).

Details

The quantiles that fall outside the surveyed cumulative range are linearly extrapolated from the outermost segment and flagged with a warning: a quantile below the share of the most developed stage has partially eclosed before the survey, a quantile above the share of the least developed stage indicates that younger stages were missed. Stages are sorted by days to eclosion, so the row order of the input is irrelevant; a stage sharing its days value with another stage is allowed but flagged (check the stage durations).

Value

A list of class "emergence":

survey_date

the survey Date

table

data.frame: stage, count (or percent), proportion, cumulative share, days to eclosion, projected eclosion date

predictions

data.frame: label, p, interpolated days (fractional, measured from the survey date), projected calendar date, and hatch_date when applicable

interpolate

closure function(p) returning the interpolated days for arbitrary quantiles (for further programming)

n, n_stages, pre_ovip, egg_days, p, labels

the inputs

See Also

emergence_analyze (the main entry point), emergence_read, emergence_export

Examples

## Overwintering-generation survey, 40 individuals (Tianyang case):
d <- data.frame(
  stage = c("Pupal exuviae", paste("Pupa", 7:1), "Prepupa", "Larva 5"),
  count = c(2, 3, 5, 7, 7, 5, 3, 4, 2, 2),
  days  = seq(0, 18, 2))          # days from that stage to eclosion
fit <- emergence_calc(d, survey_date = "2026-03-20")
fit                                  # three quantile dates
fit$table                            # cumulative development
predict(fit, c(0.25, 0.75))          # arbitrary quantiles

## With the hatch projection (pre-oviposition 3 d + egg 10 d):
fit2 <- emergence_calc(d, survey_date = "2026-03-20",
                       pre_ovip = 3, egg_days = 10)
fit2$predictions

insectecol documentation built on Oct. 5, 2026, 5:08 p.m.