Package 'extr'

Title: Extinction Risk Estimation
Description: Estimates extinction risk from population time series under a drifted Wiener process using MLE and observation-error-and-autocovariance-robust estimators, with confidence intervals based on the w-z method.
Authors: Hiroshi Hakoyama [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-7464-0754>)
Maintainer: Hiroshi Hakoyama <[email protected]>
License: BSD_2_clause + file LICENSE
Version: 1.1.1
Built: 2026-06-09 08:19:48 UTC
Source: https://github.com/hakoyamah/extr

Help Index


Extinction Risk Estimation for a Density-Independent Model

Description

Estimates demographic parameters and extinction probability under a density-independent (drifted Wiener) model. From a time series of population sizes, it estimates growth rate and variance using either a naive MLE variance estimator or an observation-error-and-autocovariance-robust (OEAR) estimator, then evaluates extinction risk over a horizon tt^{\ast} with confidence intervals from the wwzz method. In the observation-error-free setting, the naive wwzz interval achieves near-nominal coverage, while OEAR can be more robust under additive observation error and unknown short-run autocovariance.

Usage

ext_di(
  dat,
  ne = 1,
  th = 100,
  alpha = 0.05,
  unit = "years",
  qq_plot = FALSE,
  formatted = TRUE,
  digits = getOption("extr.digits", 5L),
  method = c("naive", "oear")
)

Arguments

dat

Data frame with two numeric columns: time (strictly increasing) and population size. Column names are not restricted.

ne

Numeric. Extinction threshold ne1n_e \ge 1. Default is 1.

th

Numeric. Time horizon t>0t^{\ast} > 0. Default is 100.

alpha

Numeric. Significance level α(0,1)\alpha \in (0,1). Default is 0.05.

unit

Character. Unit of time (e.g., "years", "days", "generations"). Default is "years".

qq_plot

Logical. If TRUE, draws a QQ-plot of standardized increments to check model assumptions (naive method only). Default is FALSE.

formatted

Logical. If TRUE, returns an "ext_di" object; otherwise returns a raw list. Default is TRUE.

digits

Integer. Preferred significant digits for printing. Affects display only. Default is getOption("extr.digits", 5).

method

Character. Variance estimation method. "naive" uses the MLE variance. "oear" uses the OEAR HAC long-run-variance estimator (AR(1) pre-whitening + Bartlett kernel). Default is "naive".

Details

Population dynamics follow

dX=μdt+σdW,dX=\mu\,dt+\sigma\,dW,

where X(t)=logN(t)X(t)=\log N(t) and WW is a Wiener process. Extinction risk is

G=Pr[TtN(0)=n0,ne,μ,σ],G=\Pr[T\le t^{\ast}\mid N(0)=n_0,n_e,\mu,\sigma],

the probability that population size falls below nen_e within tt^{\ast}. Irregular observation intervals are allowed.

The function first estimates μ\mu, then estimates a variance quantity according to method:

  1. naive: uses the drifted-Wiener MLE variance (Dennis et al., 1991).

  2. oear: uses an observation-error-and-autocovariance-robust (OEAR) HAC long-run-variance estimator with AR(1) pre-whitening and a Bartlett kernel (Hakoyama, in press).

For method = "oear", robustness to additive observation error relies on long-run-variance cancellation of differenced observation error (McNamara and Harding, 2004), while robustness to unknown short-run autocovariance comes from HAC estimation of long-run variance.

Extinction probability is then computed as G(w,z)G(w,z) (Lande and Orzack, 1988), and confidence intervals are constructed using the wwzz method (Hakoyama, in press).

Value

A list (class "ext_di" when formatted=TRUE) containing extinction-risk estimates and diagnostics. Core elements include Growth.rate, Variance, Unbiased.variance, lower_cl_s, upper_cl_s, linear_g, log_g, log_q, ci_linear_g, ci_log_g, ci_log_q, and data/input summaries (nq, xd, sample.size, unit, ne, th, alpha).

Variance is method-dependent (naive MLE for method="naive", OEAR HAC estimate for method="oear"). aic is reported only for method="naive" and is NA for method="oear". method_diag is NULL for naive and contains rho_tilde_pw and j for oear. lower_cl_s and upper_cl_s are chi-square based: exact under method="naive" model assumptions, and pragmatic plug-in approximations for method="oear".

References

Andrews, D. W. K. (1991). Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica, 59(3), 817-858.

Dennis, B., Munholland, P.L., and Scott, J.M. (1991) Estimation of growth and extinction parameters for endangered species. Ecological Monographs, 61, 115-143.

Hakoyama, H. Confidence intervals for extinction risk: validating population viability analysis with limited data. Methods in Ecology and Evolution. In press. Preprint, doi:10.48550/arXiv.2509.09965

Lande, R. and Orzack, S.H. (1988) Extinction dynamics of age-structured populations in a fluctuating environment. Proceedings of the National Academy of Sciences, 85(19), 7418–7421.

McNamara, J. M. and Harding, K. C. (2004). Measurement error and estimates of population extinction risk. Ecology Letters, 7(1), 16-20.

Newey, W. K. and West, K. D. (1987). A simple, positive semi-definite, heteroskedasticity and autocorrelation consistent covariance matrix. Econometrica, 55(3), 703-708.

See Also

statistics_di, oear_sigma2_hac, extinction_probability_di, confidence_interval_wz_di, print.ext_di

Examples

# Example from Dennis et al. (1991), Yellowstone grizzly bears.
# Population is a running 3-year sum (3-year moving total) digitized from
# Fig. 5.
dat <- data.frame(Time = 1959:1987,
Population = c(44, 47, 46, 44, 46, 45, 46, 40, 39, 39, 42, 44, 41, 40,
33, 36, 34, 39, 35, 34, 38, 36, 37, 41, 39, 51, 47, 57, 47))

# Probability of decline to 1 individual within 100 years
ext_di(dat, th = 100)

# Probability of decline to 10 individuals within 100 years
ext_di(dat, th = 100, ne = 10)

# With QQ-plot
ext_di(dat, th = 100, ne = 10, qq_plot = TRUE)

# OEAR method
ext_di(dat, th = 100, method = "oear")

# Irregularly spaced observations: ML method
# Under the drifted Wiener process model, the ML method uses the exact
# likelihood for the observed time intervals; no interpolation is needed.
dat_irregular <- subset(dat, Time %in% c(1959, 1960, 1962, 1965,
                                         1969, 1974, 1980, 1987))

ext_di(dat_irregular, th = 100, ne = 10)

# A mostly complete annual series with a few missing observations
# can also be supplied using NA values. The ML method then uses the
# observed intervals between non-missing observations.
dat_with_na <- data.frame(
  Time = 1959:1975,
  Population = c(44, 47, NA, 44, 46, 45, 46, NA, 39, 39,
                 42, 44, NA, 40, 33, 36, 34)
)

ext_di(dat_with_na, th = 100, ne = 10)

# OEAR method with mild missingness
# Unlike the ML method above, OEAR is an effective-diffusion approximation
# based on the long-run variance of increments. Mild missingness is
# acceptable, but avoid using method = "oear" when missing observations
# are numerous or observation intervals are highly heterogeneous.
ext_di(dat_with_na, th = 100, ne = 10, method = "oear")