Skip to contents

est_mean_age() computes the pressure-weighted mean fish age from a est_age_distribution() object using the ratio estimator \(\bar{A} = \sum_a a \hat{N}_a / \sum_a \hat{N}_a\), with delta-method standard error.

Usage

est_mean_age(ad, conf_level = NULL)

Arguments

ad

A creel_age_distribution object from est_age_distribution().

conf_level

Numeric confidence level for confidence intervals. Defaults to the level stored in ad (usually 0.95).

Value

A data.frame with class c("creel_mean_age", "data.frame") and columns: grouping columns (if any), mean_age, mean_age_se, mean_age_ci_lower, mean_age_ci_upper. Rows where the total estimated fish is zero or negative return NA for all numeric columns with a warning.

Details

Each integer age \(a\) contributes its survey-weighted count \(\hat{N}_a\). Mean age is the ratio of total age-weighted count to total count: $$\bar{A} = \frac{\sum_a a \hat{N}_a}{\hat{N}}$$

Variance is propagated via the delta method for a ratio estimator, treating cross-class covariances as zero: $$\widehat{\text{Var}}(\bar{A}) \approx \frac{1}{\hat{N}^2} \sum_a (a - \bar{A})^2 \, \widehat{\text{SE}}_a^2$$

Examples

data(example_calendar)
data(example_interviews)
data(example_ages)
data(example_catch)


design <- creel_design(example_calendar, date = date, strata = day_type)
design <- add_interviews(design, example_interviews,
  catch = catch_total, effort = hours_fished, harvest = catch_kept,
  trip_status = trip_status
)
#> Warning: ! No `n_anglers` provided — assuming 1 angler per interview.
#>  Pass `n_anglers = <column>` to use actual party sizes for angler-hour
#>   normalization.
#>  If the interviews really are one angler each, pass `n_anglers = 1` to state
#>   that and silence this warning.
#>  Added 22 interviews: 17 complete (77%), 5 incomplete (23%)
# Species catch is required to group by species: the totals are scaled onto
# the reported catch, and only this table records it per species.
design <- add_catch(design, example_catch,
  catch_uid = interview_id,
  interview_uid = interview_id,
  species = species,
  count = count,
  catch_type = catch_type
)
design <- add_ages(design, example_ages,
  age_uid = interview_id,
  interview_uid = interview_id,
  species = species,
  age = age,
  age_type = age_type
)

ad <- est_age_distribution(design, by = species)
#> Warning: ! Age totals were rescaled onto the reported catch.
#>  Measured fish (weighted): 18; reported: 93 -- a factor of 5.17.
#>  estimate, se and the confidence bounds describe the REPORTED catch, estimated
#>   from the measured subsample. Shares (percent) are unaffected.
est_mean_age(ad)
#>   species mean_age mean_age_se mean_age_ci_lower mean_age_ci_upper
#> 1    bass 2.600000   0.1456703         2.3144914          2.885509
#> 2 panfish 1.000000   0.3400005         0.3336113          1.666389
#> 3 walleye 4.444444   0.2706522         3.9139759          4.974913