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 as a black line 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)
# NOT RUN { data(bryceveg) # returns a vegetation data.frame data(brycesite) # returns and environmental data.frame envrtest(bryceveg$berrep>0,brycesite$elev)
# }