DOI: 10.5061/dryad.jm63xsjp5
title: Data from: Estimating latent individual demographic heterogeneity using structural equation models

description: Understanding the drivers of fitness is a key goal of population and
 evolutionary ecology. However, measuring individual variation in
 demographic components in imperfectly observed populations of wild
 organisms is extremely challenging. Recent research has demonstrated that
 estimates of fixed individual variation in Bernoulli variables (e.g.,
 survival, breeding propensity) are often unreliable in the face of
 imperfect detection and small sample sizes. Thus, we demonstrate the use
 of structural equation modeling approaches to simultaneously estimate
 latent variation in demographic performance, and link said variation to
 individual demographic components. We demonstrate the use of this approach
 with 30+ year capture-recapture datasets collected on two passerine
 species (White-throated dipper, Cinclus cinclus, and Pied flycatcher,
 Ficedula hypoleuca), and pied flycatcher, \textit{Ficedula hypoleuca}),
 and simultaneously estimate latent variation in individual quality and
 age-specific variation in demographic components. We found senescent
 decline in survival and fecundity in both species, and demonstrated strong
 among-individual heterogeneity in demographic performance. Notably,
 residual reproductive value of older individuals of higher quality was
 greater than younger individuals of reduced and average quality. We
 demonstrate that this approach may be useful in a variety of situations,
 discuss its limitations, and make suggestions for future research. To
 reproduce these analyses, we provide two capture-recapture datasets
 (dipper and flycatcher) collected over decades in Switzerland. We also
 provide relevant code for analyses, as well as code for data simulation.
description: # Data from: Estimating latent individual demographic heterogeneity using
 structural equation models Dataset DOI:
 [10.5061/dryad.jm63xsjp5](10.5061/dryad.jm63xsjp5) ## Description of the
 data and file structure The data (dipper*_*Data.RData &
 flycatcher*_*Data.RData) were collected during long-term
 capture-mark-recapture and nest-monitoring efforts near Zurich (dipper)
 and Baulmes (flycatcher), Switzerland. Researchers monitored 1,001
 breeding attempts by 588 uniquely marked female pied flycatchers (290 of
 unknown age) that produced 476 recruits, and 1,322 breeding attempts by
 674 uniquely marked female dippers (354 of unknown age) that produced 865
 recruits. ### Files and variables #### File: cjs\_MVN\_gamma.stan
 **Description:** This is a Stan model that analyzes the data created by
 the script Gamma_Stan_Simulation_CJS.R using a bivariate normal
 parameterization. #### File: cjs\_SEM\_gamma.stan **Description:** This is
 a Stan model that analyzes the data created by the script
 Gamma_Stan_Simulation_CJS.R using a structural equation model
 parameterization. #### File: dipper\_Data.RData **Description:** This
 .RData file contains the dipper data used in the analysis. Full
 descriptions of objects in the data file are listed below: * ch: a
 capture-history - fec: a ragged array of years in which a fecundity
 attempt was observed for each individual * z: years in which each
 individual's latent state was known (i.e., 1 if between first and
 last encounter, NA otherwise) - a: is the age at entry into the marked
 population for each individual (NA if unknown) * f: the first year an
 individual was observed - fec.limit: the number of years of observations
 of individual's breeding attempts * i & n.ind: the number of
 individuals in the study - l: the last occasion an individual was observed
 * n.years: the number of years of observation - n.fec: NULL  * rings:
 metal rings id's - y: the capture recapture data (y[,,1], 1 if
 observed, 0 if not observed) and recruitment data (y[,,2] number of
 recruits from each attempt) #### File: flycatcher\_Data.RData
 **Description:**  * fec: a ragged array of years in which a fecundity
 attempt was observed for each individual - z: years in which each
 individual's latent state was known (i.e., 1 if between first and
 last encounter, NA otherwise) * a: is the age at entry into the marked
 population for each individual (NA if unknown) - age.index: NULL * end:
 the final year of the data used in the study - f: the first year an
 individual was observed * fec.limit: the number of years of observations
 of individual's breeding attempts - i & n.ind: the number of
 individuals in the study * l: the last occasion an individual was observed
 - n.years: the number of years of observation * nl & rc: NULL  -
 rings: metal rings id's * s: the site at which each individual was
 breeding (s = 1 refers to Baulmes, s = 2 refers to Corcelles) - start: the
 first year of the study * y: the capture recapture data (y[,,1], 1 if
 observed, 0 if not observed) and recruitment data (y[,,2] number of
 recruits from each attempt) #### File: PIFL\_latent\_linear\_eta.R
 **Description:** This code fits a Bayesian hierarchical model in JAGS to
 estimate survival and fecundity of flycatchers while accounting for age,
 annual variation, and individual latent quality (`eta`). It then
 visualizes posterior estimates and the relationship between individual
 quality, survival, and fecundity. #### File:
 Gamma\_Stan\_simulation\_CJS.R **Description:** This R script runs a
 simulation study to compare two Bayesian models (MVN and SEM) implemented
 in Stan for estimating individual-level heterogeneity in survival and
 fecundity. It generates synthetic data under known parameters, fits both
 models across multiple scenarios (varying releases and occasions), and
 stores results for performance evaluation. #### File:
 WTDI\_latent\_1\_2linear\_eta.R **Description:** This R script loads
 demographic data and fits a Bayesian hierarchical model using JAGS to
 estimate age-specific survival and fecundity in a wild bird population,
 accounting for individual and temporal heterogeneity. It includes priors,
 random effects, and latent age structures, and produces posterior
 estimates and plots of survival and fecundity by age. ## Code/software R,
 Rstudio, Rstan, and JAGS