plot.invacost.costmodel {invacost}R Documentation

Plot model predictions of cost trends over time

Description

This function provides different plotting methods for the estimated annual cost of invasive species based on the temporal trend of costs.

Usage

## S3 method for class 'invacost.costmodel'
plot(
  x,
  plot.breaks = 10^(-15:15),
  plot.type = "facets",
  models = c("ols.linear", "ols.quadratic", "robust.linear", "robust.quadratic", "gam",
    "mars", "quantile"),
  evaluation.metric = FALSE,
  graphical.parameters = NULL,
  ...
)

Arguments

x

The output object from modelCosts

plot.breaks

a vector of numeric values indicating the plot breaks for the Y axis (cost values)

plot.type

"single" or "facets". Defines the type of plot you want to make: a single facet with all models ("single"), or a facet per category of model ("facets")

models

the models the user would like to appear in the plots. Can be any subset of the models included in 'modelCosts'. Default is all models.

evaluation.metric

TRUE or FALSE. If TRUE, the Root Mean Square Error evaluation metric will be displayed on bottom right of the graph (except for quantile regressions, for which it not relevant). The displayed RMSE is the one based on calibration data only (see the slot RMSE in your modelCosts object)

graphical.parameters

set this to "manual" if you want to customise ggplot2 parameters. By default, the following layers are configured: ylab, xlab, scale_x_continuous, theme_bw and, if cost.transf = "log10", scale_y_log10 and annotation_logticks. If you specify grahical.parameters = "manual", all defaults will be ignored.

...

additional arguments, none implemented for now

Note

Error bands represent 95 regression, GAM and quantile regression. We cannot construct confidence intervals around the mean for MARS techniques. However, we can estimate prediction intervals by fitting a variance model to MARS residuals. Hence, the error bands for MARS model represent 95 by fitting a linear model to the residuals of the MARS model. To learn more about this, see varmod

If the legend appears empty (no colours) on your computer screen, try to zoom in the plot, or to write to a file. There is a rare bug where under certain conditions you cannot see the colours in the legend, because of their transparency; zooming in or writing to a file are the best workarounds.

References

https://github.com/Farewe/invacost

Leroy Boris, Kramer Andrew M, Vaissière Anne-Charlotte, Kourantidou Melina, Courchamp Franck & Diagne Christophe (2022). Analysing economic costs of invasive alien species with the invacost R package. Methods in Ecology and Evolution. doi:10.1111/2041-210X.13929

Examples

data(invacost)

### Cleaning steps
# Eliminating data with no information on starting and ending years
invacost <- invacost[-which(is.na(invacost$Probable_starting_year_adjusted)), ]
invacost <- invacost[-which(is.na(invacost$Probable_ending_year_adjusted)), ]
# Keeping only observed and reliable costs
invacost <- invacost[invacost$Implementation == "Observed", ]
invacost <- invacost[which(invacost$Method_reliability == "High"), ]
# Eliminating data with no usable cost value
invacost <- invacost[-which(is.na(invacost$Cost_estimate_per_year_2017_USD_exchange_rate)), ]

### Expansion

db.over.time <- expandYearlyCosts(invacost,
                                  startcolumn = "Probable_starting_year_adjusted",
                                  endcolumn = "Probable_ending_year_adjusted")

### Analysis
res <- modelCosts(db.over.time,
                  minimum.year = 1970,
                  maximum.year = 2020)

### Visualisation
plot(res)
plot(res, plot.type = "single")

[Package invacost version 1.1-6 Index]