CorIndex: CorIndex is basic initiation of variables that are the same...

Description Usage Arguments Value Author(s) References Examples

View source: R/CorrelationIndex.R

Description

This function is usually called by other function, but could be run seperatly to give many of the variables which go into the equations to calculate the phi coefficent. This is useful if manually checking the calculation.

Usage

1
CorIndex(InDataframe, speciesbinary, weighted, group, SquareID = NULL)

Arguments

InDataframe

dataframe - containing the data on species presence absence, habitat and weighting. It also optionally could contain location ID's.

speciesbinary

string - the name of the binary field within InDataframe that contains binary presence absence for a species at the location.

weighted

string - name of habitat weighting field. For example, proportion of habitat, but any weighting with all habitats at a location adding to 1.

group

string - ID of habitats or groups of interest.

SquareID

string - optional ID of each location. Useful later for permutating the locations to calculate p-values.

Value

a custom class "CorIndexVar" containing all values which are the same for all habitats and don't need to be recalculated for every habitat. Including Nk, nk, the habitats "GroupDF", N, K, Ngp, nkoverNk ng & n. See De Cáceres and Legendre (2009) This is reused to give all the results later.

Author(s)

Jordan Chetcuti

References

De Cáceres, M., & Legendre, P. (2009). Associations between species and groups of sites: indices and statistical inference. Ecology, 90(12), 3566–3574.

Chetcuti, J., Kunin, W. E. & Bullock, J. M. A weighting method to improve habitat association analysis: tested on British carabids. Ecography (Cop.). 42, 1395–1404 (2019).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    #Using the included dataframe Species1
    Inputs_species1 = CorIndex(InDataframe = Species1, speciesbinary = 'Species1', weighted = 'Proportion', group = 'HabId', 'LocationID')
    Inputs_species1$nkoverNk

    #Using the included dataframe Species2
    #If you wanted the analysis to be non-weighted.
    Species2Unweight = Species2[which(Species2$Proportion==1),]
    #This analysis is then the unweighted version of the analysis. SquareID is not needed.
    Inputs_species2 =  CorIndex(InDataframe = Species2Unweight, speciesbinary = 'Species2', weighted = 'Proportion', group = 'HabId')
    names(Inputs_species2)

Zabados/PhiCor documentation built on Oct. 9, 2021, 1:24 a.m.