Learn R Programming

labdsv (version 1.2-0)

envrtest: Environmental Distribution Test

Description

Calculates whether the value of a specified environmental variable has an improbable distribution with respect to a specified vector

Usage

envrtest(set,env,numitr=1000,minval=0,replace=FALSE,
     plotit = TRUE, main = paste(deparse(substitute(set)),
     " on ", deparse(substitute(env))))

Arguments

set
a vector of logical or quantitative values
env
the quantitative variable whose distribution is to be tested
numitr
the number of randomizations to iterate to calculate probabilities
minval
the threshold to use to partition the data into a logical if set is quantitative
replace
whether to permute (replace=FALSE) or bootstrap (replace=TRUE) the values in the permutation test
plotit
logical; plot results if TRUE
main
title for plot if plotted

Value

  • Produces a plot on the current graphics device, and an invisible list with the components observed within-set difference and the p-value.

Details

Calculates the maximum within-set difference in the values of vector env, and the distribution of the permuted random within-set differences. It then plots the observed difference as a red line, and the sorted permuted differences and prints the probability of getting such a limited distribution. The probability is calculated by permuting numitr-1 times, counting the number of times the permuted maximum difference is as small or smaller than observed (n), and calculating (n+1)/numitr. To get three-digit probabilities, set numitr=1000 (the default)

References

http://ecology.msu.montana.edu/labdsv/R

Examples

Run this code
data(bryceveg) # returns a vegetation data.frame
    data(brycesite) # returns and environmental data.frame
    envrtest(bryceveg$berrep>0,brycesite$elev)

Run the code above in your browser using DataLab