plot.trend: Plot an estimated trend.

View source: R/trendAnalysis.R

plot.trendR Documentation

Plot an estimated trend.

Description

The function plots an estimated trend or index, as well as estimates of any temporal random effects included in the trend term.

Usage

## S3 method for class 'trend'
plot(
  x,
  baseline = NULL,
  alpha = 0.05,
  ylab = "abundance index",
  trendCol = "black",
  lineCol = adjustcolor("black", alpha.f = 0.05),
  shadeCol = adjustcolor("#0072B2", alpha.f = 0.4),
  incCol = "#009E73",
  decCol = "#D55E00",
  plotGrid = TRUE,
  plotLines = FALSE,
  ranef = "pointCI",
  secDeriv = TRUE,
  ...
)

Arguments

x

A fitted object of class trend.

baseline

A time point or function used to compute the baseline of the trend (see Knape 2023). If the argument is numeric, the point in the trendGrid argument of the function ptrend closest to this value will be taken as the baseline (i.e. the estimated trend will be 1 at this point). If the argument is a function, the function is applied to trends and the resulting value is used as the baseline. By default, the first time point is taken as the reference.

alpha

The alpha level of confidence intervals.

ylab

The label of the y-axis.

trendCol

The color of the trend line.

lineCol

The color of bootstrapped trend lines, if plotted.

shadeCol

The color of the confidence region.

incCol

The color of regions where the first or second derivative is significantly increasing.

decCol

The color of regions where the first or second derivative is significantly decreasing.

plotGrid

If true, grid lines are plotted.

plotLines

If true, the bootstrapped trends are plotted.

ranef

String indicating whether to plot point estimates and/or confidence intervals for random effects. One of 'pointCI', 'point', 'CI' or 'no'.

secDeriv

If true, coloured boxes at the bottom of the plot shows segments where the second derivative of the smooth is significantly different from zero.

...

Further arguments passed to plot.default.

Details

Trends and indexes are relative measures and therefore are compared against some reference value. By default, the first observed time point is used as the reference value.

If the estimated trend contains bootstrap samples, confidence intervals are plotted as well. For smooth trend models, time periods where the trend is significantly declining or increasing are marked with a different color (set by arguments decCol and incCol). Periods where the second derivative is significantly positive or negative are marked by coloured boxes at the bottom of the plot.

There is an additional option of plotting each of the bootstrapped trends.

Author(s)

Jonas Knape

References

Knape, J. (2023). Effects of choice of baseline on the uncertainty of population and biodiversity indices. Environmental and Ecological Statistics, 30, 1–16. <doi:10.1007/s10651-022-00550-7>


jknape/poptrend documentation built on Nov. 24, 2023, 7:07 a.m.