Geometric Morphometrics for Mathematica Package

Download Polly Morphometrics 12.2 here
User's Guide here
Updated 5 March 2017

This Mathematica add-on package performs common geometric morphometric functions. Includes Procrustes superimposition, thin-plate spline graphics, Centroid Size calculation, Procrustes distance calculation, Mantel tests, Ancestral Node reconstruction, Eclidean Distance Matrix Analysis (EDMA), and import function for TPS files.

Installation: The file is a ".m" file, which can be imported into Mathematica 6.0 and later (functions do not work in earlier versions of Mathematica). Install using the "Install" item on the "File" menu. Once installed, you must load the package like any other with the line "<<PollyMorphometrics", using either this suggested name or another. If some functions do not work, load the MultivariateStatistics and Combinatorica packages.

Changes in Version 12.x: Upgrade of PrincipalCoordinates[] function to return principal coordinates scores from a data matrix based on Euclidean distance with option for Gower distance. Update in BreakOutlines[] function to space points at equal distances across the breakpoints in addition to within the outline segments. Fixed bugs that affected ReconstructAncestorShapes[], TreeToMorphospace[], and PhylogeneticPrincipalComponentsOfShape[] in data sets with many taxa and landmarks. Added Mantel[] and MantelForMorphometrics[] functions to test similarity in covariance structure.

Changes in Version 11.x: Upgrade of tpsImport[] function to be compatible with OUTLINES; addition of function to break curves and outlines into segments and place equally spaced semilandmarks on them. Bug fix in tpsSpline[] that caused spline images to be malformed when the number of landmarks was large and shape differences were large. Bug fix in BreakOutlines[] that cause function to fail if two or more outline points were equidistant from nearest landmark point. Bug fix in tpsImport[] for files with both outlines and scale factors.

Changes in Version 10.x: Addition of ShapeMANOVA function to perform one-way multivarite analysis of variance (MANOVA) on Procrustes superimposed coordinates, new version of EqualSpace function to arrange points on a curve or outline, minor improvements to the performance of the functions that reconstruct ancestral shapes or project phylogenetic trees into shape space.

This package is used in the Indiana Univesrity course G562, Geometric Morphometrics.

Cite as:  Polly, P.D.  2017.  Geometric morphometrics for Mathematica. Version 12.1. Department of Earth and Atmospheric Sciences, Indiana University: Bloomington, Indiana.

 

Geometric Morphometrics for Mathematica User Guide

Phylogenetics for Mathematica Package

Download Polly Phylogenetics 5.1 package here
User's Guide here
Updated 7 July 2018

This add-in package for Mathematica performs basic phylogenetic functions, including reading and drawing Newick format trees, calculating phylogenetically independent contrasts, reconstructing ancestral values for continuous traits, performing random walks, and simulating continuous traits on phylogenetic trees.

The file is a ".m" file, which can be imported into Mathematica 6.0 and later (functions do not work in earlier versions of Mathematica). Install using the "Install" item on the "File" menu.

Once installed, you must load the package like any other with the line "<<PollyPhylogenetics", using either this suggested name or another.

Changes in Version 2.3: Addition of LineageEvolution function to simulate trait evolution in an anagenetic lineage under models of Brownian motion, directionality, or stabilizing processes.

Changes in Version 3.0: Simplification of SimulateContinuousTraitsOnTree function.

Changes in Version 4.x:

ReadNewick (improved function): Newick format files without branch length specifications are now automatically imported with unit branch lengths.

ReconstructNodes (improved function): fixed incompatibilities that caused problems with TreeToMorphospace[] and PhylogeneticPrincipalComponents[] functions in the Morphometrics for Mathematica package.

Changes in Version 5.x:

ThreeModelTest (new function): Performs evolutionary model selection on trait data from an evolving lineage as described by Hunt (2006). Updated July 2018 to remove minor inconsistencies with Hunt's code.

PagelsLambda (new function): Calculates Pagel’s Lambda for a univariate continuous trait on a phylogenetic tree.

 

Cite as:  Polly, P.D.  2018.  Phylogenetics for Mathematica. Version 5.0. Department of Earth and Atmospheric Sciences, Indiana University: Bloomington, Indiana.

 

Phylogenetics for Mathematica User Guide

Quantitative Paleontology Mathematica Package

Download Polly Quantitative Paleontology 5.0 package here
User's Guide here
Updated 18 June 2016

This package is for use in the Indiana University course GEOL G563, Quantitative Paleontology.

The file is a ".m" file, which can be imported into Mathematica 6.0 and later (functions do not work in earlier versions of Mathematica). Install using the "Install" item on the "File" menu.

Once installed, you must load the package like any other with the line "<<PollyQuanPaleo", using either this suggested name or another. If some functions do not work, load the DataLink packages.

Changes in 5.x: Added functions for Principal Coordinates Analysis (PCO) and Gower distances. Fixed bugs in Disparity[] and DisparityWithStages[] and added new character-based distance metric.

Changes in 4.x: All functions return data using new methods that conserve memory. Disparity[] function updated so it calculates statistics over all dimensions of morphospace. LetThereBeLight[] function now stops when standing diversity reaches 10,000 lineages unless user specifies otherwise. LetThereBeLightWithPseudoExtinction[] is a new function similar to LetThereBeLight, but with pseudo extinction of the parent lineage when speciation takes place. ConvertParacladeToTree[] is a new function that converts the output of LetThereBeLightWithPseudoExtinction[] to Newick format so that it can be drawn or analysed using functions from the Phylogenetics for Mathematica package.

Changes in 3.0: LRI[], a new function to estimate rate and mode of evolution using the Log-Rate/Log-Interval method of Gingerich (1993).

Cite as:  Polly, P.D.  2016.  Quantitative Paleontology for Mathematica. Version 4.3. Department of Earth and Atmospheric Sciences, Indiana University: Bloomington, Indiana.

 

Quantitative Paleontology User's Guide

Modularity for Mathematica Package

Download the Modularity 2.0 package here
User's Guide here
Updated 7 April 2018

This package contains functions for analyzing morphological integration and modularity. The scope of the package and instructions for its use are contained in the accompanying User Guide. It accompanies the review of modularity by Goswami and Polly (2010).  Users are referred to that paper for a discussion of the methods embedded in this package, including their strengths and weaknesses, and for elaboration of other methods that address broader problems.  

The package itself is a ".m" file, which can be imported into Mathematica 6.0 and later (functions do not work in earlier versions of Mathematica). Save the file as text then install using the "Install" item on the "File" menu. Once installed, you must load the package like any other with the line "<<Modularity`", using either this suggested name or another.

Package was updated April, 2018 to be compatible with recent versions of Mathematica.

Cite as: Polly, P.D. and A. Goswami. 2010. Modularity for Mathematica, Version 2.0. Department of Earth and Atmospheric Sciences, Indiana University: Bloomington, Indiana.

 

Modularity for Mathematica User Guide
 

R Functions

These functions were written by A. Michelle Lawing, Valerie J. Syverson, and P. David Polly for use in two Indiana Unversity classes (GEOL G-600 "Geometric Morphometrics" and GEOL G-690 "Quantitative Paleontology") and in the Paleobiology Database short course. They can be used either by clicking on the function name and pasting the text file into R. If you would like to load all of these functions, use the following R command:

source("http://mypage.iu.edu/~pdpolly/Software/RFunctions/AllFunctions.R")

For Geometric Morphometrics

collect.landmarks()
A function to open jpeg files and collect landmarks. Requires the ReadImages library.

collect.landmarksScale()
A function to open jpeg files and collect landmarks where each image has a scale bar. The first two points define the ends of the scale bar. Requires the ReadImages library.

collect.outlines()
A function to open jpeg files and collect landmarks where the landmarks are afterwards resampled down to n equally spaced outline points. Requires the ReadImages library.

fix.landmarks()
Allows errors to be corrected in data generated by collect.landmarks().

fix.outlines()
Allows errors to be corrected in data generated by collect.outlines().

efourier()
Function from Julien Claude's text for generating eliptical fourier coefficients from 2D points.

GPA.by.hand()
Code to perform steps in generalized Procrustes analysis to see what they do.

grf2()
performs a generalized resistant fit theta rho analysis

group.dists()
Returns the Procrustes distances between group means given landmark coordinates of several samples. Requires shapes() library.

read.tps()
Reads a simple TPS file. Note that this function only reads data that are classed as landmarks or outlines. Landmarks are returned inthe format used by Ian Dryden's shapes() package.

read.tps()
If the above function doesn't work for your TPS file, try this one. This should work with 3D landmarks. Landmarks are returned inthe format used by Ian Dryden's shapes() package.

write.landmarks()
Function that takes a three-dimensional array of landmarks that are in the format for the shapes() package and writes them as a comma-delimited text file.

write.tps()
Writes a text file of landmark coordinates in TPS format. Data to be written should be in the format used by Ian Dryden'' shapes package.

 

Monte Carlo Methods for Evolutionary Lineages

degrade()
Subsamples from a monte carlo lineage produced by the random walk function.

long.randomwalk()
Performs a randomwalk of n generations, reporting the values of traits at the end of the random walk.

long.randomwalk.efficient()
Performs a randomwalk of specified number of generations, reporting the values of traits at the end of the random walk. Draws from a single normal distribution so it is very quick.

randomwalk()
Generates a brownian-motion random walk and saves each step for plotting.

 

Rates of Evolution

lri()
Performs Gingerich's Log-rate/Log-interval analysis of evolutionary rates. Note that this function does not use robust regression as recommended by Gingerich and so may produced biased estimates of the per-generation rate of evolution. Data are dentered as a two-column matrix, the first column with morphological measurements, the second with the age of the stratum.

lriInt()
Performs Gingerich's Log-rate/Log-interval analysis of evolutionary rates. Note that this function does not use robust regression as recommended by Gingerich and so may produced biased estimates of the per-generation rate of evolution. Data are entered into the function as a pairwise distance matrix and an interval matrix.

 

Morphological Disparity

disparity.univariate()
Calculates morphological disparity from univariate data.

group.disparity()
Calculates morphological disparity among gorup means for several groups with multivariate data.

individual.disparity()
Returns the disparity among individuals of a sample.

 

Monte Carlo Methods for Diversity and Clade Dynamics

Cohort.Plot()
Performs a cohort analysis of survivorship on clade data that are in the format created by LetThereBeLight().

Diversity.Plot()
Produces a spindle diagram for a clade whose data are in the formated created by LetThereBeLight().

LetThereBeLight()
Simulates the evolution of diversity in one or more clades.

Lineage.Plot()
Produces a plot that shows the stratigraphic ranges of all lineages evolved in LetThereBeLight() simulation.

 

Indiana University Bloomington