fitmodel: Fitting of species rank abundance distribution to data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/fitmodel.R

Description

Fits niche apportionment models, proposed by Tokeshi (1990, 1996), to data using procedures proposed by Bersier & Sugihara (1997) and modified by Cassey & King (2001) and Mouillot et al. (2003). The protocol use relative abundance to fit simulated species rank abundance of particular model to observed rank abundance using Monte Carlo approach. The fitmodelCl function use parallel computation for run simulations.

Usage

1
2
  fitmodel(x, model, count, nRand = 999, ...)
  fitmodelCl(x, model, count, nRand = 999, nCores = 2, ...)

Arguments

x

Data frame or matrix with observed species ranks (ordered from largest abundance to smallest) at columns and replicates at rows. See 'Details' for more information.

model

String containing one of follow values: "dominanceDecay", "dominancePreemp", "MacArthurFraction", "powerFraction", "randAssort", "randFraction".

count

Define if measure of abundance is number of individuals. See 'Details' for more information.

nRand

Number of simulations.

nCores

Number indicating number of processor cores or threads to be used for simulation. See 'Details' for more information.

...

Arguments to be passed to functions. This is used when fit Power Fraction model to inform value of parameter w.

w
Number informing exponential parameter to weighting fraction selection by abundance. See 'Details' of powerFraction for more information.

Details

The observed replicates in data frame or matrix x must be in rows and ranked by abundance. First rank (column 1) must be of the species with largest abundance, second column with second largest abundance, and so on until the species with smallest abundance. Note that this protocol do not require species identification. First rank of replicates 1, for instance, may not be the same as first rank of replicates 2. Note too that number of species may be differ among replicates. In this case, zeros must be used to the rank(s).

The fit use the protocol proposed by Cassey & King (2001) and ranked relative abundance recommendations by Mouillot et al. (2003), with some modifications, as the follow:

  1. Run specific model for ranked observed abundance of each replicates, retaining the total abundance and number of ranks present in each replicate. Transform simulated abundance to relative abundance and calculate mean (M) and variance (V) of each rank for all replicates n. This procedures is repeated nRand times and result in nRand M and V for all S ranks.

  2. Transform observed abundance of each replicates in relative abundance, retaining the rank.

  3. Calculate mean (M0) and variance (V0) of each rank for observed replicates.

  4. Calculate the estimated p-value for mean of each rank M0[S] in nRand simulated rank M[S]:

    p(M)[S] = 2 * min((bl + 1) / (nRand + 1), (bs + 1) / (nRand + 1)),

    where bl is the number of simulated means (M[S]) larger than M0[S], bs is the number of simulated means (M[S]) smaller than M0[S]. This procedures is the same to variances (p(V)[S]).

  5. Summarize estimated p-values for mean (p(M)[S]) and variances (p(V)[S]) calculating T0 as follow:

    T0(M0) = - 2 sum(log(p[S](M))) and T0(V0) = - 2 sum(log(p[S](V))).

  6. Calculate the distribution of T of each rank as follow: for each M[S] of all nRand means simulations calculate T(M) using steps 4-5. This procedures is the same to variances T(V).

  7. Calculate the final estimated p-value to fit data for model as follow:

    p-value = t / (nRand + 1),

    where t is the number of T(M) values greater than T0(M0). The same for variance.

For more details see Bersier & Sugihara (1997), Cassey & King (2001) and Mouillot et al. (2003). Model fits to the observed abundance if p-value to means and variances are not significant at predetermined significance level (probability of found observed T at simulated T). The observed T value (TMobs or TVobs, see 'Value' bellow) measure how well model fits to data; better fit had smaller value (Bersier & Sugihara 1997).

fitmodelCl use parallel computation to divide the number of simulations among the processor cores or threads and run the procedures simultaneously. When nCores = 1 the function detect number of cores or threads automatically. If you inform incorrectly the number of cores or threads, the function will inform you to correct information or will recommend to use fitmodel. The overall process using parallel computation can be twice as fast, depending on the number of processor cores or threads used.

Value

An object of class fitmodel.

Author(s)

Mario J. Marques-Azevedo

Maintainer: Mario J. Marques-Azevedo <mariojmaaz@gmail.com>

References

Bersier, L.-F. & Sugihara, G. 1997. Species abundance patterns: the problem of testing stochastic models. J. Anim. Ecol. 66: 769-774.

Cassey, P. & King, R. A. R. 2001. The problem of testing the goodness-of-fit of stochastic resource apportionment models. Environmetrics 12: 691-698.

Mouillot, D. et al. 2003. How parasites divide resources: a test of the niche apportionment hypothesis. J. Anim. Ecol. 72: 757-764.

Tokeshi, M. 1990. Niche apportionment or random assortment: species abundance patterns revisited. J. Anim. Ecol. 59: 1129-1146.

Tokeshi, M. 1996. Power fraction: a new explanation of relative abundance patterns in species-rich assemblages. Oikos 75: 543-550.

See Also

For models see dominanceDecay, dominancePreemp, MacArthurFraction, randFraction, randAssort and powerFraction.

For fit models see fitmodel. To find best w parameter to powerFraction see findPFw.

For class see fitmodel.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  # Creating an (abstract) observed data
  data <- matrix(nrow = 10, ncol = 40)
  for(i in 1:length(data[ ,1])){
    data[i, ] <- randFraction(N = 100, S = 40, count = FALSE)
  }

  # Fitting Random Fraction to (abstract) observed data
  m1 <- fitmodelCl(x = data, model = "randFraction", count = FALSE, nRand = 99, nCores = 2)

  # Show fitting result
  m1

  # Get simulated data statistics
  m1@sim.stats

MarioJose/nicheApport documentation built on May 7, 2019, 2:52 p.m.