pred.error.bands: Prediction uncertainty

View source: R/pred.error.bands.R

pred.error.bandsR Documentation

Prediction uncertainty

Description

This function plots the response curves showing the effect of the predictors (i.e. trait-based and neutral forces) on joint occupancy as the response variable, with prediction error bands (as the standard deviation from the mean of the response variable) for all orders of joint occupancy.

Usage

pred.error.bands(
  s.data,
  t.data,
  p.d.mat,
  metric = "Simpson_eqn",
  gbsm.model,
  d.f = 4,
  simm = 10,
  orders,
  degree = 3,
  n = 1000,
  max.vif = 40,
  max.vif2 = 30,
  start.range = c(-0.1, 0)
)

Arguments

s.data

A species-by-site presence/absence data.frame with entries indicating occurrence (1) and non-occurrence (0) of species in a site.

t.data

A data.frame with traits as columns and species as rows. The species must be the same as in s.data.

p.d.mat

A symmetric matrix with dimnames as species and entries indicating the phylogenetic distance between any two of them (species).

metric

As for gbsm_m.orders.

gbsm.model

As for gbsm_m.orders.

d.f

As for gbsm_m.orders.

simm

Number of Monte Carlo simulations performed

orders

As for gbsm_m.orders

degree

As for gbsm_m.orders.

n

As for gbsm_m.orders.

max.vif

As for gbsm.

max.vif2

As for gbsm.

start.range

As for gbsm_m.orders.

Value

pred.error.bands function returns:

predictors

a data.frame of predictors

responses

a data.frame of response values of predictors

responses.sim_stats

a data.frame of the reponses' mean and standard deviation (from simm replicates), and

  • the response curves with prediction error bands for all orders of joint occupancy

References

  1. Lagat, V. K., Latombe, G. and Hui, C. (2021a). A multi-species co-occurrence index to avoid type II errors in null model testing. DOI: ⁠<To be added>⁠.

  2. Lagat, V. K., Latombe, G. and Hui, C. (2021b). Dissecting the effects of random encounter versus functional trait mismatching on multi-species co-occurrence and interference with generalised B-spline modelling. DOI: ⁠<To be added>⁠.

Examples

## Not run: 
 my.path <- system.file("extdata/gsmdat", package = "msco")
 setwd(my.path)
 s.data <- get(load("s.data.csv")) ## Species-by-site matrix
 t.data <- get(load("t.data.csv")) ## Species-by-Trait matrix
 p.d.mat <- get(load("p.d.mat.csv")) ## Species-by-species phylogenetic distance matrix

 RNGkind(sample.kind = "Rejection")
 set.seed(1)
 pe <- msco::pred.error.bands(s.data, t.data, p.d.mat, metric="Simpson_eqn", d.f=4, simm=10,
  orders = c(2:5, 8, 10, 15), degree=3, n=1000, gbsm.model, start.range=c(-0.2, 0))

 pe$predictors$`order 2`
 pe$responses$`order 2`
 pe$responses.sim_stats$`order 2`

 pe$predictors$`order 3`
 pe$responses$`order 3`
 pe$responses.sim_stats$`order 3`

 pe$predictors$`order 10`
 pe$responses$`order 10`
 pe$responses.sim_stats$`order 10`

 
## End(Not run)


vitaliskim/msco documentation built on Sept. 29, 2023, 9:22 p.m.