Skip to content
Nuée

Guide

Monitoring: series, TRIM, distance sampling

Series

Plots › Series (or in the explorer, under the project): a variable over time, like figures of series by sector, one page per site. Choose the variable, the time (a variable or an ID made of numbers, like the year, or of dates: see Dates as time), the lines (a qualitative variable or an ID: the sector) and, optionally, the panels (the site): one small plot per panel, in a grid with shared axes. Within a line, times that follow each other at its own step (its smallest gap) are joined, so a sector counted every other year stays one line; a missing time breaks the line, so a year without a count shows. Dates, rarely evenly spaced, go on a date axis, and a line joins all its points. Colours go by line within each panel and the legend is grouped by panel (a click on an entry hides its line): it stays readable with 30 sectors. Optionally: the mean of each panel's lines, time by time (a thick line), a log scale (values ≤ 0 aren't shown on it) and events, times typed as "2015; 2019" (with dates, also 2019-05-14 or 14/05/2019), drawn as dashed lines in every panel. Hovering gives the observation's name, the time and the value; a click or a box selects observations, also in the project's models when the selection is shared with them. Observations without a time, a value, a line or a panel are left out and counted; a line with the same time twice (sectors chosen without their site) is flagged and shown as points. Right-click: copy or save the image.

Trends (the toolbar's box): under the plot, a table gives for each line of each panel, marked with its colour, n (its times with a value), its first and last time; Sen's slope (Sen, 1968: the median of the slopes between all pairs of its times, per time unit, per year with dates) and its 95 % interval (Gilbert, 1987: the ranked slopes, taken around the median from the variance of S; no bounds when there are too few times); Kendall's τ (tau-b), the Mann–Kendall S and its two-sided p by the normal approximation (variance corrected for ties, continuity correction, as trend::mk.test and Kendall::MannKendall do); and the p corrected over the lines (Benjamini–Hochberg, or Holm as a choice). A line with fewer than 4 times, the same time twice or the same value at every time isn't tested, and the table says why; Ctrl+C copies it. The test takes the times as independent: positive autocorrelation (years that resemble each other) makes p too small. For a trend that accounts for it: Plots › Residual autocorrelation, then a mixed model with a CAR1 autocorrelation, the year as an X.

In the table's toolbar, two options change the test. Allow for autocorrelation: Hamed and Rao's (1998) modified Mann–Kendall test, computed as modifiedmk::mmkh computes it: the line detrended by its Sen slope (over its actual times), the ranks of what remains, their autocorrelation at each lag (counted from one time to the next: the time after a missing year is one lag away), those beyond ±1.96/√n kept (the others count 0), and Var(S) multiplied by n/n* = 1 + 2/(n(n − 1)(n − 2)) Σ (n − k)(n − k − 1)(n − k − 2) ρ(k); p and the slope's interval come from that variance, and the n/n* column gives the factor (1: no autocorrelation kept; a factor that isn't positive, from a strong negative autocorrelation, leaves the line untested). It needs a long series: an autocorrelation is poorly estimated from few times (Box and Jenkins, 1976, ask for about 50), and with 15 times only one beyond ±0.51 counts; even with 60 to 90 times the corrected test still rejects a true absence of trend too often when the autocorrelation is strong (Blain, 2013). It corrects each line on its own: it is no substitute for a mixed model with a CAR1 autocorrelation, which estimates the trend shared by the sites and their sectors, with the autocorrelation within each.

Seasons: the seasonal Kendall test (Hirsch, Slack and Smith, 1982), for samples taken several times a year, the season given by the month of a time made of dates, or by a qualitative variable or an ID (season, month). The year of a value is the whole part of its time (the calendar year of a date); several values in a season of the same year count as one, their median (as some implementations do; EnvStats would keep them all, as ties in time), and a note says how many. In each season seen in at least 2 years: the Mann–Kendall S between its years and its variance with ties; S and Var(S) are summed over the seasons, taken as independent, and p comes from the normal approximation with the continuity correction, as trend::smk.test and EnvStats::kendallSeasonalTrendTest compute them. The seasonal Sen slope is the median of the slopes between years within each season (per year, or per time unit), its 95 % interval taken from Var(S) as Gilbert (1987) does (the ranks rounded, as for the Sen slope above; EnvStats interpolates between them); τ is EnvStats': the seasons' τ averaged, weighted by their years.

A season seen in a single year doesn't count; a line with fewer than 4 values in the seasons that count, or with the same value every year in each season, isn't tested; observations without a season are left out of the test, and counted. The seasonal test takes the seasons as independent: autocorrelation from one month to the next makes p too small, and Allow for autocorrelation doesn't apply to it (Hirsch and Slack, 1984, give a correction, not done here). The Test column gives each line's test; the correction over the lines stays the same.

Distance sampling: density and abundance

New model › type "Distance sampling (density, abundance)": the density and abundance of a population from the distances of the animals detected from lines (line transects) or from points (point transects, point counts), as the ds() and dht2() functions of the Distance package compute them (Buckland et al. 2001; Miller et al. 2019). The data: the flat table, one row per detection, as Distance reads it:

  • the distance (Y): the perpendicular distance from the line, or the distance from the point;
  • the transect (the line or the point: an ID or a variable) and its effort, the same on all its rows: the length of the line, or for points the number of visits (no column: one visit per point);
  • optional: the stratum (the region: an ID or a variable) and its area, the same on all its rows (without an area, or areas all 0, the density only); the size of each detected group;
  • a transect without any detection stays a row, its distance empty, so that its effort counts; rows without a transect and a distance are left out.

For example, with Distance's column names (the dialog proposes them from the names):

Region.Label  Area  Sample.Label  Effort  distance  size
North         630   N-01          2.4     35        2
North         630   N-01          2.4     120       1
North         630   N-02          1.8               (no detection)

General tab:

  • line or point transects;
  • the truncation: the largest distance (ds's default), a distance, or a percentage of the largest distances (5 to 10% is usual); a left truncation if needed. Detections beyond it leave the model, their transect stays;
  • intervals, for distances recorded in classes (as ds(cutpoints = )): their bounds, e.g. "0 10 25 50 100"; each distance of the table (the true one, or its class's midpoint) counts in its interval, the first bound is the left truncation and the last w; the likelihood is then that of the counts of the classes, and the goodness of fit the chi-square on them;
  • the key of the detection function g(x): half-normal exp(−x²/2σ²), hazard-rate 1 − exp(−(x/σ)^−b) (b ≥ 1, as mrds) or uniform;
  • covariates (multiple-covariate distance sampling, as ds(formula = ~ x1 + x2); Marques and Buckland 2003, Marques et al. 2007): the variables whose Role is Z in the Variables tab, or added from the Covariates list of the General tab (the same thing). The scale σ of the half-normal or hazard-rate key depends on them, ln σ = β0 + β1 x1 + …: a quantitative covariate as it is, a qualitative one through an indicator of each of its categories but the first present among the detections, its reference (R's treatment contrasts); the group size can be one. Each detection then has its own detection function and its own probability of detection pi. As ds: no adjustment terms unless a number is given, no monotonicity constraint, no uniform key; the covariates are taken as they are (no transformation), known for every detection within the truncation;
  • the adjustment terms: cosine (the default), Hermite polynomials or simple polynomials, their number chosen by AIC as ds() does (the key alone, then one more term at a time while the AIC falls, five at most; orders 2, 3, 4… for cosines, 4, 6, 8… for Hermite and polynomials, 1, 2, 3… and 2, 4, 6… with the uniform key) or fixed; the distances in the terms divided by the truncation w (ds's default) or by σ;
  • monotonicity: mrds's constraint on a function with adjustment terms, checked at 10 distances from 0 to w: strict (the default: g decreases), weak (g stays below g(0)), or none; g stays positive there;
  • the units of the distances, of the effort (lines) and of the areas, or a conversion factor (Distance's convert_units): the density is per unit of area, and the results say it.

The detection function is fitted by maximum likelihood on the exact distances; its parameters' variance comes from the outer product of the distances' scores, as mrds; p, the average probability of detection within the truncation, and its standard error by the delta method; the effective strip half-width ESW = p w (lines) or the effective detection radius EDR = w √p (points). The density of each stratum is D = n / (a p), a the covered area (2 w L, or 2 (w − L) L with a left truncation, for lines; π w² K for points); its variance combines the encounter rate's between transects (the R2 estimator for lines, P2 for points, Fewster et al. 2009), that of p, and that of the mean group size; its 95% interval is log-normal with Satterthwaite degrees of freedom, as dht2. The total over the strata adds their abundances (with areas) or weights their densities by their covered areas (without). Without areas, each stratum's encounter rate and group size variances enter the total's with the square of its weight, and the total's degrees of freedom are those of Satterthwaite's formula with these weights. dht2 leaves the weights out of the group size variance, which gives a larger standard error with groups, and out of its degrees of freedom's denominator, which gives fewer degrees of freedom, and a wider total interval, sometimes absurdly so: on Distance's amakihi data (7 strata, hn ~ OBs + MAS), 0.6 instead of 871, and an interval of 0.09 to 434 birds per hectare instead of 5.85 to 6.89. The strata's intervals don't depend on it. The Summary, the Density and abundance view and the Methods text give dht2's numbers as well. Refused, and named: a negative distance, a missing or zero effort, two efforts for one transect, two areas for one stratum, an area of zero beside others, a distance without a transect.

With covariates, the likelihood is that of each detection's distance given its covariates (mrds's flpt.lnl, or the counts of the classes); the coefficients are fitted on the quantitative covariates centred and scaled, then returned in their units. The same settings without covariates are fitted too, first in the list of models, to compare the AICs (as Distance's summarize_ds_models). p̄ = n / Σ 1/pi is the average probability of detection, with its standard error as mrds's summary.ds, and ESW = p̄ (w − L) or EDR = w √p̄; the density of each stratum is dht2's Horvitz–Thompson-like estimator D = Σ si / pi / a (si the group size, 1 without groups), its detection variance by the delta method on all the parameters; the goodness of fit compares each distance with the detection function of its covariates (Cramér–von Mises on their fitted distributions, the chi-square's expected counts summed over the detections). Refused, and named: a covariate missing for a detection, a qualitative covariate with a single category among the detections, a quantitative one with a single value, covariates that follow from one another, and a combination of covariates whose scale σ runs off to infinity (its distances don't fall off up to w: group the categories, or choose others).

Views: Summary (the model retained and the AIC of each model fitted on the way, p and ESW or EDR with their standard errors, the parameters, the goodness of fit, the overall density and abundance with their intervals; what was left out; with covariates, the covariates and their reference categories, and the coefficients on ln σ with exp(β), the factor on σ of a category against its reference or of one unit of a quantitative covariate); Detection function (the histogram of the distances, each bar its count over the count it would have if every animal were detected, as mrds's plot.ds, under the fitted g; each detection on the curve, a click selects its row; for points, the density of the distances f(r) = 2r g(r) / (w² p) too; below, the chi-square's classes; with covariates, the average detection function, each detection's g given its covariates weighted by 1/pi as plot.ds, each detection at its own g, and "by" a qualitative covariate one curve per category, the average over its detections as plot.ds(subset = )); QQ plot (the fitted distribution of each distance against the empirical one, with the Cramér–von Mises test; not for distances in intervals); Density and abundance (by stratum and overall: area, covered area, effort, transects, detections, encounter rate and its CV, D, its standard error, CV, 95% interval and df, N and its interval, the share of the variance due to the encounter rate, to detection and to group size; with groups, the density of groups too). The observation list gives each detection's g and, with covariates, its probability of detection pi. Methods and Results texts with their references, Export and report as for the other models, and Export to R: a script or report that redoes the analysis with R alone, without Distance or mrds, the distance sampling functions of Nuée's engine copied into it (the same candidates and AICs, parameters and their covariance, p or p̄ and each detection's pi, ESW or EDR, goodness-of-fit tests, density and abundance as Nuée; the detection function over the histogram, one curve per category of each qualitative covariate, and the QQ plot in base R). No prediction.

The results are those of Distance 2.0 (moteur/tests/verifier_distance.R compares them, with covariates on Distance's amakihi, ETP_Dolphin, ClusterExercise, unimak and golftees data), with these known differences: Nuée integrates the hazard-rate key exactly where mrds approximates its integral by a smoothing spline (lines, the key without adjustment terms, with or without covariates: parameters and p differ by about 1e-4); with a left truncation of line transects the covered area is 2 (w − L) L, where dht2 keeps 2 w L; without stratum areas, the strata's weights enter the total's group size variance (squared) and its Satterthwaite degrees of freedom, where dht2 leaves them out of both: a larger standard error with groups, and fewer degrees of freedom; mrds's optimizer under the monotonicity constraint stops within 1e-6 of the likelihood, so its estimates can differ from Nuée's in the fourth digit, or, on rare data, settle on another local optimum. With covariates: ds can stop short of the maximum on poorly conditioned covariates (on unimak, hn ~ MSTDO + Hour, on a plateau where σ is e^9 or more, thousands of times w, 21.9 log-likelihood units below the maximum Nuée finds; started from Nuée's estimates, ds stays there); a combination of covariates whose σ runs off to infinity is refused, where ds returns the point where its optimizer stopped; when the group size is a covariate, dht2 recomputes each detection's probability with a size of 1 for the variance of its density of groups, where Nuée keeps the detection's own (the densities of individuals agree); for points, the density of the distances drawn is the mean of the detections' f(r | z), the density the histogram estimates, where plot.ds weights them by 1/pi. And dht2 keeps a transect without detection within the truncation only if its Sample.Label has no detection in any stratum (amakihi repeats its labels across strata): Nuée keeps every transect's effort.

This page is part of the guide installed with Nuée (USER-GUIDE.txt, also in Help › User guide).