| tsa.test | R Documentation |
Implimentation of Bowman and Somers (2006) Test Site Analysis (http://goo.gl/h4JAGP).
For implimenation as in Bowman and Somers (2006) use distance=NULL, outlier.rem=F, m.select=F. This function allows optional funcationality including automatic selection of
indicator metrics using metric.select, as well as outlier removal from the reference set using arw or pcout.
An alternative mahalnobis distance calculation is also implimented using weighted means and covariance matrix. The weights are supplied from
the ecological distance between test sites and reference sites using site.match.
tsa.test(Test, Reference, distance = NULL, outlier.rem = F, m.select = F,
rank = F, na.cutoff = 0.7, outbound = 0.1)
Test |
Data frame of metric scores at the test site. |
Reference |
Data frame of metric scores at the reference sites. |
distance |
Vector of weights to use for optional weighted Mahalanobis Distance calculation. Can be output of |
outlier.rem |
Logical argument indicating whether |
m.select |
Logical argument indicating whether the best subset of metrics should be automatically selected from the data. |
na.cutoff |
A value between 0-1 indicating the percent of the reference set that can contain NAs for any metric. NAs are replaced by the mean value. |
outbound |
Used if outlier.rem=T A numeric value between 0 and 1 indicating the outlier boundary for defining values as final outliers (default to 0.1) |
$general.results - Table containing the number and names of reference sites used and number of indicator metrics used
$tsa.results - Table containing the status rank of the test site, numerical interval and equivalence test, test site's mahalanobis sistance, the upper and lower critical mahalanobis distance values, the non-centrallity parameter lambda and F-value of the test site
$jacknife - Table conataining the jacknifed consistency of the status rank and 95
$partial.tsa - Only present if the test site is ranked impaired or possibly impaired. Table containing p and F values for each metric's contribution to the overall mahalanobis distance score
$mahalanobis.distance - vector of reference sites and test site mahalanobis distance scores
$z.scores - Table containing test and reference sites metrics standrdized to z-scores of the reference sites only
#load datasets
data(YKEnvData,envir = environment()) #Biological dataset
data(YKBioData,envir = environment()) #Environmental dataset
#Calculate indicator metrics from raw biological data
bio.data.test<-benth.met(YKBioData,2,2)
#Extract just the summary metrics
bio.data<-bio.data.test$Summary.Metrics
#standardize row names between datasets
rownames(YKEnvData)<-bio.data.test$Site.List
#Match a test site (#201) to the nearest neighbour reference set
nn.sites<-site.match(YKEnvData[201,-c(1)],YKEnvData[1:118,-c(1)],k=NULL,adaptive=T)
#Calculate additional metrics based on selected Reference sites
taxa.data<-add.met(Test=bio.data.test$Raw.Data[201,],Reference=bio.data.test$Raw.Data[names(nn.sites$final.dist),])
#TSA test of indicator metrics at test site and reference sites selected used site.match()
tsa.results<-tsa.test(Test=taxa.data[nrow(taxa.data),],Reference=taxa.data[names(nn.sites$final.dist),],distance=nn.sites$final.dist, outlier.rem=T, m.select=T)
tsa.results
#Evaluate Results
boxplot(tsa.results)
plot(tsa.results)
pcoa.tsa(tsa.results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.