Geomorph users,

A new function in geomorph 2.1.3 allows the user to explore Procrustes superimposed data for outliers (plotOutliers). Here I shall provide a few example for loops to demonstrate how you can explore your data for outliers prior to analyses.

1) **plotTangentSpace** to visualise aberrant individuals

To label all the individuals in the biplot so strong outliers can be identified:

plotTangentSpace(coords, labels = dimnames(coords)[[3]])#

If your data has group structure (e.g. species), make a factor for this grouping variable then you can plot each level at a time using:

for(i in levels(group)){

plotTangentSpace(coords[,,which(group == i)],

label = dimnames(coords)[[3]][which(group == i)])}

2) **plotOutliers** to find outliers by ordering individuals by their distance from the mean

outliers <- plotOutliers(coords)

If you have a lot of specimens, make a PDF of all specimens plotted as vector shape change graphs:

outliers <- plotOutliers(coords)

pdf(“AllSpecimens.pdf”)

for(i in 1:length(outliers)){ plotRefToTarget(mshape(coords), coords[,,outliers[i]],

method=”vector”, label = T) title(names(outliers[i]))}

dev.off()

If your data has group structure, make a factor for this grouping variable then you can examine outliers for each level at a time using:

for(i in levels(group)){

outliers <- plotOutliers(coords[,, which(group == i)])

title(i) }

Combining these two makes a PDF for each level in the group with the summary graph and the shape change graphs:

for(i in levels(group)){

outliers <- plotOutliers(coords[,, which(group == i)])

title(i)

pdfname <- paste(i, “.pdf”, sep=””)

pdf(pdfname)

plotOutliers(coords[,, which(group == i)])

for(j in 1:length(outliers)){

plotRefToTarget(mshape(coords), coords[,,outliers[j]], method=”vector”, label = T)

title(names(outliers[j]))

}

dev.off()

}

Emma

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** geomorph**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...