
{"id":185,"date":"2014-10-23T23:11:04","date_gmt":"2014-10-23T23:11:04","guid":{"rendered":"http:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/?page_id=185"},"modified":"2016-01-12T12:16:59","modified_gmt":"2016-01-12T20:16:59","slug":"pmi-2","status":"publish","type":"page","link":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/software\/pmi-2\/","title":{"rendered":"pmi"},"content":{"rendered":"<h2 style=\"color: #4e8db6\"><span style=\"color: #3366ff\">DISPERSAL DIVERSITY : STATISTICS AND TESTS<\/span><\/h2>\n<p style=\"color: #333333\">This is a collection of\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/www.r-project.org\/\">R<\/a>\u00a0functions to facilitate analysis of dispersal in biological communities. The bulk of the functions calculate dispersal diversity statistics and allow for comparison of diversity statistics, as described in Scofield\u00a0<em>et al.<\/em>\u00a02012\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/www.jstor.org\/stable\/10.1086\/668202\"><em>American Naturalist<\/em>\u00a0180: 719-732<\/a>.<\/p>\n<p style=\"color: #333333\">There are also new functions for calculating allelic diversity using these same conceptual and statistical principles, and for comparing allele diversity statistics.<\/p>\n<p style=\"color: #404040\">The most current versions of all files can be found below &amp; here:<br \/>\n<a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\">https:\/\/github.com\/douglasgscofield\/dispersalDiversity<\/a><\/p>\n<ul style=\"color: #404040\">\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/pmiDiversity.R\">pmiDiversity.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/diversityTests.R\">diversityTests.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/plotPairwiseMatrix.R\">plotPairwiseMatrix.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/gammaAccum.R\">gammaAccum.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/alleleDiversityTests.R\">alleleDiversityTest.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/alleleGammaAccum.R\">alleleGammaAccum.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/allelePmiDiversity.R\">allelePmiDiversity.R<\/a><\/li>\n<li style=\"color: #204e91\"><a href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity\/blob\/master\/R\/membershipPlot.R\">membershipPlot.R<\/a><\/li>\n<\/ul>\n<hr style=\"color: #333333\" \/>\n<p style=\"color: #333333\">The\u00a0<span style=\"font-weight: bold\">Mann-Whitney-Wilcoxon nested ranks test<\/span>\u00a0we originally provided here has been made an R package and has been moved to\u00a0<a style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/nestedRanksTest\">its own repository<\/a>.<\/p>\n<hr \/>\n<p style=\"color: #333333\"><span style=\"color: #008080\"><em>These statistical tools were developed in collaboration with Peter Smouse (<span style=\"color: #3366ff\"><a style=\"color: #4183c4\" href=\"http:\/\/www.rci.rutgers.edu\/~deenr\/PES.html\"><span style=\"color: #3366ff\">Rutgers University<\/span><\/a><\/span>) and Victoria Sork (<span style=\"color: #3366ff\"><a style=\"color: #4183c4\" href=\"https:\/\/www.eeb.ucla.edu\/Faculty\/Sork\/Sorklab\/\"><span style=\"color: #3366ff\">UCLA<\/span><\/a><\/span>) and were funded by U.S. National Science Foundation awards NSF-DEB-0514956 and NSF-DEB-0516529.<\/em><\/span><\/p>\n<hr \/>\n<h2 style=\"color: #333333\"><span style=\"color: #3366ff\">Dispersal Diversity<\/span><\/h2>\n<h3 style=\"color: #333333\"><a id=\"user-content-input-requirements\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#input-requirements\"><\/a>Input requirements<\/h3>\n<p style=\"color: #333333\">All functions take as input a simple data structure: a table of site (rows) by source (columns) counts. Though we originally developed the diversity tests to understand seed dispersal in plant populations, the tests themselves should be useful for biodiversity data or any other diversity-like data that can be expressed with this same data structure.<\/p>\n<h3 style=\"color: #333333\"><a id=\"user-content-getting-started\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#getting-started\"><\/a>Getting started<\/h3>\n<p style=\"color: #333333\">The\u00a0<code>pmiDiversity.R<\/code>\u00a0and\u00a0<code>diversityTests.R<\/code>\u00a0source files are required for performing diversity tests. If all that is desired are PMI (<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1111\/j.1365-294X.2005.02680.x\">Grivet\u00a0<em>et al.<\/em>\u00a02005<\/a>,\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1111\/j.1365-2745.2010.01649.x\">Scofield\u00a0<em>et al.<\/em>\u00a02010<\/a>,\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1007\/s00442-010-1828-5\">Scofield\u00a0<em>et al.<\/em>\u00a02011<\/a>) and diversity (<a style=\"color: #4183c4\" href=\"http:\/\/www.jstor.org\/stable\/10.1086\/668202\">Scofield\u00a0<em>et al.<\/em>\u00a02012<\/a>) statistics (<i>qgg<\/i>,\u00a0<i>\u03b1g<\/i>, etc.), the source file\u00a0<code>pmiDiversity.R<\/code>\u00a0contains the<code>pmiDiversity()<\/code>\u00a0function that provides these and can be used separately.<\/p>\n<p style=\"color: #333333\">Put all the source files in the same directory, and within your R session simply<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>source(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>diversityTests.R<span class=\"pl-pds\">\"<\/span><\/span>)<\/pre>\n<\/div>\n<p style=\"color: #333333\">Additional source files are provided to perform other tasks.\u00a0<code>plotPairwiseMatrix.R<\/code>\u00a0is available for plotting pairwise divergence\/overlap matrices. More information is available below. This file requires the\u00a0<code>pmiDiversity.R<\/code>\u00a0source file to be available within the same directory:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>source(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>plotPairwiseMatrix.R<span class=\"pl-pds\">\"<\/span><\/span>)<\/pre>\n<\/div>\n<p style=\"color: #333333\"><code>gammaAccum.R<\/code>\u00a0is available for collecting \u03b3 diversity accumulation information and plotting this. More information is avaialble below. This file requires the\u00a0<code>pmiDiversity.R<\/code>\u00a0source file to be available within the same directory:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>source(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>gammaAccum.R<span class=\"pl-pds\">\"<\/span><\/span>)<\/pre>\n<\/div>\n<h3 style=\"color: #333333\"><a id=\"user-content-pmidiversityr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#pmidiversityr\"><\/a>pmiDiversity.R<\/h3>\n<p style=\"color: #333333\">Defines the R function\u00a0<code>pmiDiversity()<\/code>\u00a0which takes a site-by-source table and produces statistics for Probability of Maternal Identity aka PMI (Grivet\u00a0<em>et al.<\/em>\u00a02005, Scofield\u00a0<em>et al.<\/em>\u00a02010, Scofield\u00a0<em>et al.<\/em>\u00a02011) and dispersal diversity (Scofield\u00a0<em>et al.<\/em>\u00a02012). Three different PMI and diversity statistics are calculated:<\/p>\n<ul class=\"task-list\" style=\"color: #333333\">\n<li><i>qgg<\/i>-based, known to be biased (Grivet\u00a0<em>et al.<\/em>\u00a02005)<\/li>\n<li><i>rgg<\/i>-based, unbiased but poor performers at low sample sizes (Grivet\u00a0<em>et al.<\/em>\u00a02005, Scofield\u00a0<em>et al.<\/em>2012)<\/li>\n<li><i>q*gg<\/i>-based, which apply the transformation developed by Nielsen\u00a0<em>et al.<\/em>\u00a0(2003) to be unbiased and seem to perform well (Scofield\u00a0<em>et al.<\/em>\u00a02010, Scofield\u00a0<em>et al.<\/em>\u00a02011, Scofield\u00a0<em>et al.<\/em>\u00a02012).<\/li>\n<\/ul>\n<h3 style=\"color: #333333\"><a id=\"user-content-diversitytestsr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#diversitytestsr\"><\/a>diversityTests.R<\/h3>\n<p style=\"color: #333333\">Defines several R functions which, like\u00a0<code>pmiDiversity()<\/code>, take a site-by-source table (one or more) and test diversity statistics within and among them. See (Scofield\u00a0<em>et al.<\/em>\u00a02012) for methodological details. The file\u00a0<code>pmiDiversity.R<\/code>\u00a0(see above) is required to be in the same directory, as it provides functions used here.<\/p>\n<p style=\"color: #333333\"><code>alphaDiversityTest(tab)<\/code>\u00a0: Test for differences in \u03b1 diversity among sites within a single dataset<\/p>\n<p style=\"color: #333333\"><code>alphaContrastTest(tab.a, tab.b)<\/code>\u00a0: Test whether there is a difference in the \u03b1 diversity between two datasets<\/p>\n<p style=\"color: #333333\"><code>alphaContrastTest.3(tab.a, tab.b, tab.c)<\/code>\u00a0: Test whether there is a difference in the \u03b1 diversity among three datasets<\/p>\n<p style=\"color: #333333\"><code>plotAlphaTest(result)<\/code>\u00a0: Plot the list returned from\u00a0<code>alphaDiversityTest()<\/code>\u00a0or\u00a0<code>alphaContrastTest()<\/code>\u00a0for evaluation<\/p>\n<p style=\"color: #333333\"><code>pairwiseMeanTest(tab)<\/code>\u00a0: Test whether mean pairwise divergence\/overlap among sites is different from the null espectation<\/p>\n<p style=\"color: #333333\"><code>plotPairwiseMeanTest()<\/code>\u00a0: Plot the list returned from the above test for evaluation<\/p>\n<p style=\"color: #333333\"><code>gammaContrastTest(tab.a, tab.b)<\/code>\u00a0: Test whether there is a difference in the \u03b3 diversity between two datasets<\/p>\n<p style=\"color: #333333\"><code>gammaContrastTest.3(tab.a, tab.b, tab.c)<\/code>\u00a0: Test whether there is a difference in the \u03b3 diversity among three datasets<\/p>\n<h3 style=\"color: #333333\"><a id=\"user-content-membershipplotr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#membershipplotr\"><\/a>membershipPlot.R<\/h3>\n<p style=\"color: #333333\">Provides the function\u00a0<code>membershipPlot()<\/code>\u00a0for plotting relative representations of sources within sites, and source sharing across sites, using the same site-by-source table used for input to the<code>pmiDiversity()<\/code>\u00a0function. Examples of membership plots can be seen in Figure 2A-C of Scofield\u00a0<em>et al.<\/em>2012\u00a0<i>Am Nat<\/i>. Singleton sources (those that appear just once in just one site) are distinguished using a white background, while multiton sources (those that appear multiple times but still in just one site) can be distinguished with a gray background using the option\u00a0<code>distinguish.multiton=TRUE<\/code>. Other options are provided for controlling labelling of the plot and producing output to PDF or PostScript files.<\/p>\n<p style=\"color: #333333\">The function\u00a0<code>membershipPlot.v0()<\/code>\u00a0provides the original membership plot functionality. The primary function has been generalised.<\/p>\n<h3 style=\"color: #333333\"><a id=\"user-content-plotpairwisematrixr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#plotpairwisematrixr\"><\/a>plotPairwiseMatrix.R<\/h3>\n<p style=\"color: #333333\">Provides a function for plotting pairwise diversity matrices as returned by the\u00a0<code>pmiDiversity()<\/code>function, examples of which can be seen in Figure 4A-C of Scofield\u00a0<em>et al.<\/em>\u00a0<i>Am Nat<\/i>.<\/p>\n<p style=\"color: #333333\"><code>plotPairwiseMatrix()<\/code>\u00a0: Create a visual plot of pairwise divergence or overlap values as calculated by<code>pmiDiversity()<\/code><\/p>\n<p style=\"color: #333333\">For example, with\u00a0<code>tab<\/code>\u00a0defined as above, plot the divergence matrix based on\u00a0<em>rgg<\/em>\u00a0calculations, labelling the axes &#8220;Seed Pool&#8221;, using the following code:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre><span class=\"pl-v\" style=\"color: #ed6a43\">pmiD<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> pmiDiversity(<span class=\"pl-smi\">tab<\/span>)\r\nplotPairwiseMatrix(<span class=\"pl-v\" style=\"color: #ed6a43\">pairwise.mat<\/span><span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span><span class=\"pl-smi\">pmiD<\/span><span class=\"pl-k\" style=\"color: #a71d5d\">$<\/span><span class=\"pl-smi\">r.divergence.mat<\/span>, \r\n                   <span class=\"pl-v\" style=\"color: #ed6a43\">pairwise.mean<\/span><span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span><span class=\"pl-smi\">pmiD<\/span><span class=\"pl-k\" style=\"color: #a71d5d\">$<\/span><span class=\"pl-smi\">r.divergence<\/span>, \r\n                   <span class=\"pl-v\" style=\"color: #ed6a43\">statistic<\/span><span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span><span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>divergence<span class=\"pl-pds\">\"<\/span><\/span>, \r\n                   <span class=\"pl-v\" style=\"color: #ed6a43\">axis.label<\/span><span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span><span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>Seed Pool<span class=\"pl-pds\">\"<\/span><\/span>)<\/pre>\n<\/div>\n<h3 style=\"color: #333333\"><a id=\"user-content-gammaaccumr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#gammaaccumr\"><\/a>gammaAccum.R<\/h3>\n<p style=\"color: #333333\">Provides functions for calculating \u03b3 accumulation across sites, and plotting the result, examples of which can be seen in Figure 4D-F of Scofield\u00a0<em>et al.<\/em>\u00a0<i>Am Nat<\/i>. The file\u00a0<code>pmiDiversity.R<\/code>\u00a0(see above) is required to be in the same directory, as it provides functions used here.<\/p>\n<p style=\"color: #333333\">A typical workflow using these functions would be:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre><span class=\"pl-v\" style=\"color: #ed6a43\">rga.result<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> runGammaAccum(<span class=\"pl-smi\">tab<\/span>)\r\nplotGammaAccum(<span class=\"pl-smi\">rga.result<\/span>)<\/pre>\n<\/div>\n<h4 style=\"color: #333333\"><a id=\"user-content-rungammaaccumtab\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#rungammaaccumtab\"><\/a>runGammaAccum(tab)<\/h4>\n<p style=\"color: #333333\">Perform a \u03b3 diversity accumulation on the site-by-source data in\u00a0<code>tab<\/code>. The result is returned in a list, which may be passed to\u00a0<code>plotGammaAccum()<\/code>\u00a0to plot the result. Several arguments control the method of accumulation and value of \u03b3 calculated. Only the defaults have been tested; the others were developed while exploring the data and must be considered experimental.<\/p>\n<p style=\"color: #333333\"><code>tab<\/code>\u00a0: Site-by-source table, same format as that passed to\u00a0<code>pmiDiversity()<\/code><\/p>\n<p style=\"color: #333333\"><code>gamma.method<\/code>\u00a0: Calculate \u03b3 using\u00a0<code>\"r\"<\/code>\u00a0(default),\u00a0<code>\"q.nielsen\"<\/code>\u00a0or\u00a0<code>\"q\"<\/code>\u00a0method (see paper)<\/p>\n<p style=\"color: #333333\"><code>resample.method<\/code>\u00a0:\u00a0<code>\"permute\"<\/code>\u00a0(default) or\u00a0<code>\"bootstrap\"<\/code>; whether to resample sites without (<code>\"permute\"<\/code>) or with (<code>\"bootstrap\"<\/code>) replacement<\/p>\n<p style=\"color: #333333\"><code>accum.method<\/code>\u00a0:\u00a0<code>\"random\"<\/code>\u00a0(default) or\u00a0<code>\"proximity\"<\/code>. If\u00a0<code>proximity<\/code>\u00a0is used, then\u00a0<code>distance.file<\/code>\u00a0must be supplied<\/p>\n<p style=\"color: #333333\"><code>distance.file<\/code>\u00a0: A file or data.frame containing three columns of data, with the header\/column names being\u00a0<code>pool<\/code>,\u00a0<code>X<\/code>, and\u00a0<code>Y<\/code>, containing the spatial locations of the seed pools named in the row names of tab; only used with\u00a0<code>accum.method=\"proximity\"<\/code><\/p>\n<h4 style=\"color: #333333\"><a id=\"user-content-plotgammaaccumrgaresult\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#plotgammaaccumrgaresult\"><\/a>plotGammaAccum(rga.result)<\/h4>\n<p style=\"color: #333333\">Create a visual plot of \u03b3 accumulation results from\u00a0<code>runGammaAccum()<\/code>.<\/p>\n<h4 style=\"color: #333333\"><a id=\"user-content-additional-functions\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#additional-functions\"><\/a>Additional functions<\/h4>\n<p style=\"color: #333333\">The following functions typically won&#8217;t be used separately, use\u00a0<code>runGammaAccum()<\/code>\u00a0instead.<\/p>\n<p style=\"color: #333333\"><code>gammaAccum()<\/code>\u00a0: Workhorse function for \u03b3 accumulation<\/p>\n<p style=\"color: #333333\"><code>gammaAccumStats()<\/code>\u00a0: Extracts stats from the result of\u00a0<code>gammaAccum()<\/code><\/p>\n<p style=\"color: #333333\"><code>runGammaAccumSimple()<\/code>\u00a0: Wrapper that runs and then returns stats from\u00a0<code>gammaAccum()<\/code><\/p>\n<h2 style=\"color: #333333\"><a id=\"user-content-allelic-diversity\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#allelic-diversity\"><\/a><span style=\"color: #3366ff\">Allelic Diversity<\/span><\/h2>\n<p style=\"color: #333333\">These functions calculate allelic alpha, beta and gamma diversity as described by Sork et al. (unpublished), following the same conceptual and statistical principles described in Scofield et al. (2012). These have been used to calculate the structure of allelic diversity for complete progeny genotypes as well as their decomposed male and female gametes, and to compare alpha and gamma diversity of progeny dispersed relatively short vs. long distances.<\/p>\n<h3 style=\"color: #333333\"><a id=\"user-content-input-requirements-1\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#input-requirements-1\"><\/a>Input requirements<\/h3>\n<p style=\"color: #333333\">Input begins as a file of genotypes in\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/biology-assets.anu.edu.au\/GenAlEx\">GenAlEx<\/a>\u00a0format, which is read using the [<code>readGenalex<\/code>] R package (<a style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/readGenalex\">https:\/\/github.com\/douglasgscofield\/readGenalex<\/a>) available via CRAN:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>install.packages(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>readGenalex<span class=\"pl-pds\">\"<\/span><\/span>)<\/pre>\n<\/div>\n<h3 style=\"color: #333333\"><a id=\"user-content-usage\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#usage\"><\/a>Usage<\/h3>\n<p style=\"color: #333333\">The augmented\u00a0<code>data.frame<\/code>\u00a0returned by\u00a0<code>readGenalex()<\/code>\u00a0is then processed into a list of tables, one per locus, using\u00a0<code>allele.createTableList()<\/code>. If the true ploidy of the input data does not the ploidy of the GenAlEx file, for example if haploid gametes are represented by a pair of homozygous alleles, then use the\u00a0<code>new.ploidy=1<\/code>\u00a0argument to\u00a0<code>allele.createTableList()<\/code>\u00a0to reduce the ploidy to its true level.<\/p>\n<p style=\"color: #333333\">The list of tables is analysed as a unit by\u00a0<code>allele.pmiDiversity()<\/code>, and can be passed to one of the contrast functions for testing against another list of tables.<\/p>\n<h3 style=\"color: #333333\"><a id=\"user-content-workflow\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#workflow\"><\/a>Workflow<\/h3>\n<p style=\"color: #333333\">The workflow to calculate basic allelic diversity statistics:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>library(<span class=\"pl-smi\">readGenalex<\/span>)\r\nsource(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>allelePmiDiversity.R<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">dat<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> readGenalex(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>GenAlEx-format-file-of-genotypes.txt<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">gt<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.createTableList(<span class=\"pl-smi\">dat<\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">div<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.pmiDiversity(<span class=\"pl-smi\">gt<\/span>)<\/pre>\n<\/div>\n<p style=\"color: #333333\">For comparing allele diversity between two different samples:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>library(<span class=\"pl-smi\">readGenalex<\/span>)\r\nsource(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>allelePmiDiversity.R<span class=\"pl-pds\">\"<\/span><\/span>)\r\nsource(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>alleleDiversityTests.R<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">dat1<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> readGenalex(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>file-of-genotypes-sample-1.txt<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">dat2<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> readGenalex(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>file-of-genotypes-sample-2.txt<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">gt1<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.createTableList(<span class=\"pl-smi\">dat1<\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">gt2<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.createTableList(<span class=\"pl-smi\">dat2<\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">alpha.contrast<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.alphaContrastTest(<span class=\"pl-smi\">gt1<\/span>, <span class=\"pl-smi\">gt2<\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">gamma.contrast<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.gammaContrastTest(<span class=\"pl-smi\">gt1<\/span>, <span class=\"pl-smi\">gt2<\/span>)<\/pre>\n<\/div>\n<p style=\"color: #333333\">For calculating and plotting gamma accumulation curves across all loci:<\/p>\n<div class=\"highlight highlight-R\" style=\"color: #333333\">\n<pre>library(<span class=\"pl-smi\">readGenalex<\/span>)\r\nsource(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>allelePmiDiversity.R<span class=\"pl-pds\">\"<\/span><\/span>)\r\nsource(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>alleleGammaAccum.R<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">dat<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> readGenalex(<span class=\"pl-s\" style=\"color: #183691\"><span class=\"pl-pds\">\"<\/span>genotypes.txt<span class=\"pl-pds\">\"<\/span><\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">lst<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.createTableList(<span class=\"pl-smi\">dat<\/span>)\r\n<span class=\"pl-v\" style=\"color: #ed6a43\">allele.rga.result<\/span> <span class=\"pl-k\" style=\"color: #a71d5d\">=<\/span> allele.runGammaAccum(<span class=\"pl-smi\">lst<\/span>)\r\nplotGammaAccum(<span class=\"pl-smi\">allele.rga.result<\/span>)<\/pre>\n<\/div>\n<h4 style=\"color: #333333\"><a id=\"user-content-functions-in-allelepmidiversityr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#functions-in-allelepmidiversityr\"><\/a>Functions in\u00a0<code>allelePmiDiversity.R<\/code><\/h4>\n<p style=\"color: #333333\"><code>allele.pmiDiversity()<\/code>\u00a0: The function calculating diversity for a set of loci. The single argument is a list produced by\u00a0<code>allele.createTableList()<\/code>, and it uses the function<code>allele.pmiDiversitySingleLocus()<\/code>.<\/p>\n<p style=\"color: #333333\"><code>allele.createTableList()<\/code>\u00a0: Take a data.frame of genotypes read by readGenalex(), produce a list of allele count tables used by the other functions. Each entry of the list is, for each locus, a table of site x allele counts, with row names being the site names, and column names being the names given to the individual alleles.<\/p>\n<p style=\"color: #333333\"><code>allele.pmiDiversitySingleLocus()<\/code>\u00a0: The single argument is, for a single locus, a table of site \u00d7 allele counts, with row names being the site names, and column names being the names given to the individual alleles.<\/p>\n<h4 style=\"color: #333333\"><a id=\"user-content-functions-in-allelediversitytestsr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#functions-in-allelediversitytestsr\"><\/a>Functions in\u00a0<code>alleleDiversityTests.R<\/code><\/h4>\n<p style=\"color: #333333\"><code>allele.alphaDiversityTest(lst)<\/code>\u00a0: Test whether there is a difference in the alpha diversity among patches in an allele diversity dataset, that is, whether \u03b2 = 1 or \u03b4 = 0 across a collection of patches at a site (see Sork et al.).<\/p>\n<p style=\"color: #333333\"><code>allele.alphaContrastTest(lst.a, lst.b)<\/code>\u00a0: Test whether there is a difference in the alpha diversity between two lists of allele diversity datasets.<\/p>\n<p style=\"color: #333333\"><code>allele.gammaContrastTest(lst.a, lst.b)<\/code>\u00a0: Test whether there is a difference in the gamma diversity between two allele diversity datasets.<\/p>\n<h4 style=\"color: #333333\"><a id=\"user-content-functions-in-allelegammaaccumr\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#functions-in-allelegammaaccumr\"><\/a>Functions in\u00a0<code>alleleGammaAccum.R<\/code><\/h4>\n<p style=\"color: #333333\"><code>allele.runGammaAccum(lst)<\/code>\u00a0: Perform a gamma diversity accumulation on the site-by-source data in tab. Several arguments control the method of accumulation and value of gamma calculated. Other arguments are identical to\u00a0<code>gammaAccum()<\/code>. Only the defaults have been tested; the others were developed while exploring the data and must be considered experimental. The result is returned in a list, which may be passed to\u00a0<code>plotGammaAccum()<\/code>\u00a0to plot the result.<\/p>\n<hr style=\"color: #333333\" \/>\n<h1 style=\"color: #333333\"><a id=\"user-content-references\" class=\"anchor\" style=\"color: #4183c4\" href=\"https:\/\/github.com\/douglasgscofield\/dispersalDiversity#references\"><\/a><span style=\"color: #3366ff\">References<\/span><\/h1>\n<p style=\"color: #333333\">Scofield DG, Smouse PE, Karubian J, Sork VL. 2012. Use of \u03b1, \u03b2, and \u03b3 diversity measures to characterize seed dispersal by animals.\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/www.jstor.org\/stable\/10.1086\/668202\"><em>American Naturalist<\/em>\u00a0180: 719-732<\/a>,\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/www.jstor.org\/stable\/full\/10.1086\/668202#apa\">supplement<\/a>,\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.5061\/dryad.40kq7\">data<\/a>.<\/p>\n<p style=\"color: #333333\">Scofield DG, Alfaro VR, Sork VL, Grivet D, Martinez E, Papp J, Pluess AR, Koenig WD, Smouse PE. 2011. Foraging patterns of acorn woodpeckers (<i>Melanerpes formicivorus<\/i>) on valley oak (<i>Quercus lobata<\/i>\u00a0N\u00e9e) in two California oak savanna-woodlands.\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1007\/s00442-010-1828-5\"><em>Oecologia<\/em>\u00a0166: 187-196<\/a>,\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/link.springer.com\/content\/esm\/art:10.1007\/s00442-010-1828-5\/MediaObjects\/442_2010_1828_MOESM1_ESM.doc\">supplement<\/a>.<\/p>\n<p style=\"color: #333333\">Scofield DG, Sork VL, Smouse PE. 2010. Influence of acorn woodpecker social behaviour on transport of coast live oak (<i>Quercus agrifolia<\/i>) acorns in a southern California oak savanna.\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1111\/j.1365-2745.2010.01649.x\"><em>Journal of Ecology<\/em>\u00a098: 561-572<\/a>,\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/onlinelibrary.wiley.com\/doi\/10.1111\/j.1365-2745.2010.01649.x\/suppinfo\">supplement<\/a>.<\/p>\n<p style=\"color: #333333\">Grivet D, Smouse PE, Sork VL. 2005. A novel approach to an old problem: tracking dispersed seeds.<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1111\/j.1365-294X.2005.02680.x\"><em>Molecular Ecology<\/em>\u00a014: 3585-3595<\/a>.<\/p>\n<p style=\"color: #333333\">Nielsen R, Tarpy DR, Reeve HK. 2003. Estimating effective paternity number in social insects and the effective number of alleles in a population.\u00a0<a style=\"color: #4183c4\" href=\"http:\/\/dx.doi.org\/10.1046\/j.1365-294X.2003.01994.x\"><em>Molecular Ecology<\/em>\u00a012: 3157-3164<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DISPERSAL DIVERSITY : STATISTICS AND TESTS This is a collection of\u00a0R\u00a0functions to facilitate analysis of dispersal in biological communities. The bulk of the functions calculate dispersal diversity statistics and allow for comparison of diversity statistics, as described in Scofield\u00a0et al.\u00a02012\u00a0American Naturalist\u00a0180: 719-732. There are also new functions for calculating allelic diversity using these same conceptual<\/p>\n<p><a href=\"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/software\/pmi-2\/\" class=\"more-link themebutton\">Read More<\/a><\/p>\n","protected":false},"author":15,"featured_media":754,"parent":55,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-185","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/pages\/185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/comments?post=185"}],"version-history":[{"count":14,"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/pages\/185\/revisions"}],"predecessor-version":[{"id":832,"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/pages\/185\/revisions\/832"}],"up":[{"embeddable":true,"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/pages\/55"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/media\/754"}],"wp:attachment":[{"href":"https:\/\/sites.lifesci.ucla.edu\/eeb-sorklab\/wp-json\/wp\/v2\/media?parent=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}