tsJumpStats: Compute statistics on jumps through community space

Description Usage Arguments Value Examples

View source: R/tsJumpStats.R

Description

Consecutive samples representing time points in an ordination plot can be interpreted as vectors, which have a length and an angle. If ordinate is true, these lengths and angles are computed from the selection dimensions of the ordination. If ordinate is false, dissimilarities between consecutive time points are computed. If ordinate is true, the Euclidean distance to the centroid is computed as well. If a perturbation object is provided and plot.type hist or box is true, the histogram or box plot of the perturbed and non-perturbed jump lengths is plotted and the significance of the difference between perturbed and non-perturbed jump lengths is assessed with a Wilcoxon test. Note that jump lengths plots are a visualization of beta-diversity, which is however not computed between all pair-wise but only between consecutive samples.

Usage

1
2
3
4
tsJumpStats(x, time.given = FALSE, time.unit = "days", ordinate = TRUE,
  distance = "bray", dimensions = c(1, 2), groups = c(),
  min.jump.length = 0, max.jump.length = Inf, plot = FALSE,
  plot.type = "bar", header = "", subsample = FALSE, perturb = NULL)

Arguments

x

a community time series, with rows as taxa and columns as time points

time.given

sample names provide time steps, only needed for plotting and plot.type jumps

time.unit

unit of time, only needed for plotting and plot.type jumps

ordinate

if TRUE, compute jumps in ordination plot

distance

the distance (or dissimilarity) used to compute jumps directly or to compute the ordination

dimensions

if ordinate is TRUE, the principal components considered

groups

a vector with group assignments and as many entries as there are samples

min.jump.length

minimum length of jumps to be considered for the statistic

max.jump.length

maximum length of jumps to be considered for the statistic

plot

if TRUE, a plot of the jumps is made

plot.type

bar: plot jumps as bars in the order of occurrence; box: a box plot of jump lengths; hist: a histogram of jump lengths, power: power law of jumps of a certain length, msd: mean square displacement vs time lag

header

text to be used as plot title instead of default text

subsample

for plot.type hist or box: subsample larger jump vector randomly down to smaller one, so that there are as many perturbed as non-perturbed jumps

perturb

a perturbation object, if provided, the plot is colored accordingly

Value

jump lengths (i.e. dissimilarities of community composition at consecutive time points) and, in case ordinate is true, angles are returned

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
data(david_stoolA_otus)
data(david_stoolA_metadata)
rarefaction=rarefyFilter(david_stoolA_otus,min = 10000)
rarefiedA=rarefaction$rar
days=david_stoolA_metadata[1,rarefaction$colindices]
interpA=interpolate(rarefiedA,time.vector=days,interval=1,method="stineman")
interpA[interpA<0]=0
perturbA=perturbation(times=c(80,105), durations=c(5,9))
res=tsJumpStats(interpA, plot=TRUE, perturb=perturbA, header="in stool A")
out=powerspec(res$lengths,plot=TRUE)

## End(Not run)

hallucigenia-sparsa/seqtime documentation built on June 16, 2018, 1:49 p.m.