Calculation of species habitat specialization measure from co-occurrence species data (see Theoretical background for details).
Download JUICE-R script:
(last update: 12.2.2015)
This option can be used if you calculate Multiplicative beta on species pool. Calculation of species pool using Beals smoothing can be time consuming in case of large datasets, and you may do this only once in case that you will recalculate the analysis again in future. First, run the Multiplicative beta on species pool analysis WITHOUT selecting the Beals smoothed species pool file. This will create the file
beals-data.txt file in the R working directory, which is basically the matrix of samples x species containing presences of species in species pool of all samples. In the next run of the same analysis, you can select this file and save time for it's calculation. Warning: the file must have the same dimension as the original data! 3)
If your computer has more than one core, you can speed up the calculation by running parallel processes on more than one core. Note, however, that you are still limited by the RAM memory of your computer, and that the whole original dataset is being loaded to each core separately. If your dataset is large, RAM may easily get saturated if you run the calculation on too many cores - solution is to choose less cores.
In parallel mode, you will not see the progress bar - to check for the progress, search for GS-progress.txt file in working R directory and open it for view, e.g. using Notepad4). You may be prompted by firewall to allow the parallel process run on your computer - you need to allow it to run it in parallel.
This was suggested by Botta-Dukát (2012) as a way to avoid the situation, when given species will become generalists only because it occurs in a few samples with very different species composition. This method, used by McCune & Mefford in PC-ORD program, calculates the Euclidean distances among all pairs of samples containing particular species, and removes those samples with Euclidean distance to any other sample higher than mean of all distances among samples + 2 S.D. See Botta-Dukát (2012), page 205, for details.
Habitat specialization will be calculated for species occurring in number of samples equal or higher than minimal frequency threshold. Beta diversity is always calculated from the same number of samples for all species - this number is equal to this Minimal frequency threshold. Note that all species in the table are used to calculate beta diversity metric.
Calculation of beta diversity is done from fixed number of randomly selected samples containing given species (this number is equal with Minimal frequency of species). Number of random subsamples speficies how many times this random selection will be repeated (this is important for calculating the mean and confidence intervals of habitat specialization metric).
The program generates several output files, which can be found in the R working directory 5):
To import the calculated theta values back to JUICE, you can use the file theta_import.species.data.txt, which has format appropriate for import of species data into JUICE. In JUICE menu, go to File > Import > Species Data, and selected the file theta_import.species.data.txt. In the newly open import wizard, you may need to modify the First character and the Last character values in Parameters for species selection and Species information sections 7). Select Import data for all species and click Continue and Ok.
Note that not all species have assigned specialization value, as this was not calculated for species with frequency lower than the selected threshold.
Original script was part of the supplementary materials of Fridley et al. (2007) and Zelený (2009). Current script is completely rewritten in order to enhance the efficiency of calculation, needed for larger datasets. Script performance will depend heavily on the technical parameters of the computer (mainly processor speed and size of memory). The script has an option to run parallel sessions, which greatly speeds up the calculation in case that the computer has more than one core.
Fridley et al. (2007) introduced a novel technique to estimate the measure of species habitat specialization, based on analysis of co-occurrence data extracted from large vegetation data sets. The theory is simple and straightforward: for species occupying many different habitats – generalists – the rate of species turnover among plots in which they occur will be relatively high, while for species restricted to specific habitats – specialists – the species turnover rate will be relatively low, simply because they consistently occur with a limited number of other species. A continuous metric of habitat specialization proposed by Fridley et al. (2007) is called ‘theta’ (θ) and its calculation is based on a measure of beta diversity among the plots with given species. The θ value should be an estimate of species niche width. However, given that real vegetation data are used to calculate θ, the results will reveal realized, not fundamental, species niche, and their validity will be limited to the data set used for analysis. The main advantage of this method is that there is no need for information about the ecological gradient and species position along this gradient. Instead, only a sufficiently large data set of vegetation plots and an algorithm written in R by Fridley et al. (2007) is required.
Zelený (2009) found that the original algorithm, which was using additive metric of beta diversity, suffers from dependence on the size of the species pool of particular vegetation - the species occurring in more species rich vegetation tends to be more generalists than species occurring in species poor types. Zelený (2009) suggested modification of the original algorithm, which is based on replacing original additive measure of beta diversity by multiplicative one (Whittaker's beta). In response, Manthey and Fridley (2009) tested various beta diversity metrics in order to give a guideline to the selection of the appropriate one, and introduced the use of two other beta diversity metrics as alternatives to additive and multiplicative one (namely pair-wise Jaccard and multisite Sorensen, according to Baselga et al. 2007).
Botta-Dukát (2012) pointed out that the method of Fridley et al. (2007) and Zelený (2009) works well only in case of not-saturated communities, and suggested an algorithm which gives unbiased estimates even in case of saturated communities. This algorithm calculates theta values not from the original sample-species matrix, but from species pool of each plot. This species pool is estimated by Beals smoothing (algorithm proposed by Ewald 2002 and modified by Münzbergová & Herben 2004).
install.packages (c('betapart')). The package 'parallel', which is also needed, comes already with basic R installation (since version 2.14.) and doesn't need to be installed.
betapartwritten by Baselga et al., namely by function
beta.pairfor pairwise and
beta.multifor multisite dissimilarity.