Example files: time-stratification, areas allowed

814 views
Skip to first unread message

Nick Matzke

unread,
Nov 24, 2015, 6:28:03 PM11/24/15
to BioGeoBEARS
Hi all,

Example files for time-stratified analyses have always been available in the "M3" subdirectory of the extdata R package install, but that isn't always obvious.

I've put the example files on PhyloWiki also, see:

http://phylo.wikidot.com/biogeobears --> go to very bottom of page, click "Files" at lower right. These are example extra files for the Psychotria case:
================================
areas_allowed_all1s.txt
areas_allowed.txt
manual_dispersal_multipliers_with_0s.txt
manual_dispersal_multipliers_without_0s.txt
timeperiods.txt
================================

They are best viewed in an ASCII text viewer, so that you can see the difference between spaces and tabs, you can see blank lines at the end of some files, etc.

Good programs:
TextWranger (mac), BBedit (mac), Notetab (windows), Rstudio or R.app editors, any code editor

Bad programs:
Word/Office (mac/windows), WordPad (windows), TextEdit (Mac)

Marginal:
Notepad (windows)

Cheers!
Nick


Nick Matzke

unread,
Nov 24, 2015, 8:56:42 PM11/24/15
to bioge...@googlegroups.com
Since sometimes its hard for people to find the little "Files" link at the bottom of the PhyloWiki page, I've organized the example input files here:

======================
You can see example input files in several ways:

Example files are available in the extdata directory of the BioGeoBEARS installation. In R, type np(system.file("extdata", package="BioGeoBEARS")) to see where this is.
Then navigate to that directory with your file browser (Windows Explorer in Windows — often WindowsKey+E; or Finder on a Mac).
Alternatively, go to a terminal or command prompt and type "open directoryname" (replace "directoryname" with the path).
You can also try, in R, pathname=np(system.file("extdata", package="BioGeoBEARS")); system(paste0("open ", pathname))
All of the above could be screwed up by space or differences in operating systems. Note that Windows uses backslashes in directory paths (\like\this\), Macs and UNIX/Linux use forward (/like/this/) — although Windows may cope with forward slashes now. Also, spaces can cause problems, you might have to backslash spaces: /like\ this/seendttoohard/. These things are "obvious" to experienced computational people, but can be mystifying to beginners, and it is difficult to think of all of the possible issues on all of the different computer setups people might have. So: focus on figuring out your computer's directory structure, and how to navigate it.
I have put the example files in "Files" at the VERY BOTTOM of the PhyloWiki page you are reading right not. Scroll to the bottom, click "Files". Direct links are here:
A Newick-formatted tree of Hawaiian Psychotria:

A PHYLIP-formatted geography file (C++ Lagrange format)

For a time-stratified analysis, you have to add a timeperiods file:
Note: the oldest age much be below the age of the root of your tree,
and there can only be one such age

Manual dispersal multipliers (as people did with Lagrange)

Sometimes 0s can create "impossible" data (likelihood -Inf) or underflow problems
that crash the run. If that happens, an equivalent strategy is to use very small
values instead of 0

With the "x" parameter turned on, dispersal probability will be modified by distance^x
Here is a stratified distances file for Hawaii
(Note: I did not check this rigorously for accuracy in Hawaii)
You can get distances from a map with various web tools:

Example distances file (in km)

You probably want to consider rescaling distance so that the smallest distance is 1
(and thus dispersal between these regions equals the base dispersal rate, d,
and/or the base jump dispersal weight, j)

Distances can also be used in non-stratified analyses:

Example areas_allowed matrices:

An areas-allowed matrix of "all 1s" is equivalent to specifying no areas_allowed matrix (and should return identical likelihoods

One might also want to specify an areas_adjacency matrix (which combinations of areas are allowed states; note that this is a DIFFERENT thing than modifying dispersal probabilities):

NOTE CAREFULLY: It is impossible to specify all of the possible combinations of allowed/disallowed areas/states that someone might want to do, with just square 1/0 matrices. These are intended for simple cases (like islands sinking as you go back in time).

You can manually edit the states_list, however, to set up whatever list of allowed states you like. This would be done in the R script and not in a text file. See various discussions on the BioGeoBEARS google group, e.g.

======================


--
You received this message because you are subscribed to the Google Groups "BioGeoBEARS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biogeobears...@googlegroups.com.
To post to this group, send email to bioge...@googlegroups.com.
Visit this group at http://groups.google.com/group/biogeobears.
To view this discussion on the web visit https://groups.google.com/d/msgid/biogeobears/a5664f10-aea6-41b1-8406-3d1e60b33cfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages