limitsQuality: Quality scores and plot for estimated interaction matrices

View source: R/limitsQuality.R

limitsQualityR Documentation

Quality scores and plot for estimated interaction matrices

Description

The predicted time series can be obtained by simulating the time series with Ricker or SOI at once or step-wise by computing the current abundances from the original abundances of the preceding time point. The model parameters are supposed to have been estimated from the time series previously. In case of Ricker, the function estimates carrying capacities as mean abundances. If the original interaction matrix is provided, the mean correlation between estimated and original interaction matrix is computed. Thus, two main quality scores are considered: the mean correlation between predicted and observed time series and, if provided, the mean correlation between the original and the estimated interaction matrix. To avoid explosions in case of Ricker, the estimated interaction matrix can be modified such that all its eigen values are negative using the Schur decomposition.

Usage

limitsQuality(oriTS, A, A.ori = matrix(), type = "ricker",
  m.vector = c(), e.vector = c(), spec.subset = NA, norm = FALSE,
  plot = FALSE, predict.stepwise = TRUE, sim = "r",
  noSchur = FALSE, ignoreExplosion = FALSE, sigma = -1,
  explosion.bound = 10^8)

Arguments

oriTS

the original time series, with taxa as rows and time points as columns

A

the estimated interaction matrix

A.ori

the original interaction matrix (optional)

type

the model used to predict time series from the interaction matrix, ricker or soi (for soi, predict.stepwise is set to FALSE and noSchur to TRUE)

m.vector

the immigration rates for soi (optional, if not provided set to the proportions in the first sample)

e.vector

the extinction rates for soi (optional, if not provided sampled from the uniform distribution)

spec.subset

either a vector of species indices to keep or a number to indicate how many top-abundant (sum across samples) species should be kept, applied to the matrices and time series

norm

normalize the original and predicted time series by dividing each sample by its sum (carried out before filtering species for the original time series)

plot

plot the number of species versus the mean correlation of predicted and observed time series and the mean auto-correlation

predict.stepwise

if TRUE, the predicted time series is computed step by step, else computed with a call to Ricker

sim

similarity measure to compare predicted and observed time series, either Pearson (r, default) or Kullback-Leibler dissimilarity (kld)

noSchur

do not remove positive eigenvalues

ignoreExplosion

ignore the occurrence of an explosion (for step-wise prediction only)

sigma

noise factor in Ricker

explosion.bound

the explosion boundary in Ricker

Value

a list with the taxon numbers considered (taxonnum), the mean correlation of observed and predicted time series (meancrosscor), the slope of the former (slope), the value range in the estimated matrix (AestR), the mean correlation between predicted and original matrix (corAAest) and the mean autocorrelations up to lag 5 (meanautocor1 to meanautocor5)

Examples

## Not run: 
N=20
A=generateA(N,c=0.1)
ts=ricker(N=N,A=A)
ts=normalize(ts)
Aest=limits(ts,verbose=TRUE)
out=limitsQuality(ts,A=Aest,A.ori=A, plot=TRUE)

## End(Not run)

hallucigenia-sparsa/seqtime documentation built on Jan. 9, 2023, 11:53 p.m.