time-stratification

61 views
Skip to first unread message

Dora Julieth Chávarro

unread,
Mar 4, 2025, 5:48:17 PMMar 4
to BioGeoBEARS
Hi everyone!

I'm doing an analysis with 9 regions, but I have a problem with time stratification and dispersal multipliers matrices, so I need help please. I have 3 time periods (0-5.3, 5.3-11.63, 11.63-13.82) and a dispersal matrix for each time period. For the time period from 11.63 to 13.82 Ma I defined in the dispersal matrix that only 3 regions were available for that time. But in my results it shows me a beach ball for that time period, and it shows me all the regions and they are all about the same size. I think in my results it should show me only the 3 regions available for the period 11.63-13.82 Ma because all the other regions have a value of 0 in my matrix. Could you tell me if it's normal that my results show all 9 regions in that time window when I defined that only 3 were available?

Thanks!!!



Nick Matzke

unread,
Mar 4, 2025, 5:58:37 PMMar 4
to bioge...@googlegroups.com
On Wed, Mar 5, 2025 at 11:48 AM Dora Julieth Chávarro <doraju...@gmail.com> wrote:
Hi everyone!

I'm doing an analysis with 9 regions, but I have a problem with time stratification and dispersal multipliers matrices, so I need help please. I have 3 time periods (0-5.3, 5.3-11.63, 11.63-13.82) and a dispersal matrix for each time period. For the time period from 11.63 to 13.82 Ma I defined in the dispersal matrix that only 3 regions were available for that time. But in my results it shows me a beach ball for that time period,


Hi! By "beach ball", I assume you mean a pie chart that looks like a pizza with many slices...if so...

 
and it shows me all the regions and they are all about the same size. I think in my results it should show me only the 3 regions available for the period 11.63-13.82 Ma because all the other regions have a value of 0 in my matrix.

A few possible points...

- the colors in the pie charts represent range probabilities, if you had 3 areas you could have 2^3-1 = 7 possible ranges, excluding the null range of 0 areas. So that is more than 3 colors

- time stratification and setting some dispersal rates to 0 does not by itself rule out certain areas or ranges (a "range" equals 0 or more areas, ie. null, A, B, AB, ABC are each different ranges. Sometimes an area is also a range, but not all ranges are single areas).  Among other possibilities, there could be a probability of the root node occupying several areas, and this widespread range is maintained through a period where dispersal is set to 0. 

To really disallow certain areas and/or ranges at certain timeperiods, follow this method:


from: 

==============
#######################################################
# START MANUAL MODIFICATION OF STATES LIST
# Manually modify the list of states (geographic ranges)
# to disallow some ranges that are disjunct
# (allow more complex scenarios than the area-adjacency file)
#######################################################

#######################################################
# NOTE! "areas" and "states/ranges" are DIFFERENT THINGS
# NOTHING WILL MAKE SENSE UNLESS you understand that a
# STATE/RANGE is made up of some number of areas.
#
# E.g.: 2 areas (A,B) equals
# 4 states/geographic ranges (null, A, B, AB)
#######################################################

# Get your states list (assuming, say, 4-area analysis, with max. rangesize=4)
areas = getareas_from_tipranges_object(tipranges)
#areas = c("A", "B", "C", "D")

# This is the list of states/ranges, where each state/range
# is a list of areas, counting from 0
states_list_0based = rcpp_areas_list_to_states_list(areas=areas, maxareas=max_range_size, include_null_range=TRUE)

# How many states/ranges, by default: 163
length(states_list_0based)

# Make the list of ranges
ranges_list = NULL
for (i in 1:length(states_list_0based))
    {    
    if ( (length(states_list_0based[[i]]) == 1) && (is.na(states_list_0based[[i]])) )
        {
        tmprange = "_"
        } else {
        tmprange = paste(areas[states_list_0based[[i]]+1], collapse="")
        }
    ranges_list = c(ranges_list, tmprange)
    }

# Look at the ranges list
ranges_list

# How many states/ranges, by default: 163
length(ranges_list)

# Here, we are assuming islands disappear back in time:
# 0.5 - H sinks (Hawaii Big Island)
# 1.9 - M sinks (Maui-Nui)
# 3.7 - O sinks (Oahu)
# 5.1 - K sinks (Kauai; although, we leave it up in the default Psychotria example; older islands are another setup)
# 10  - (a time older than the root of the tree, defining the oldest time-bin)

# Let's remove ranges disallowed by island disappearence:

# STRATUM 1 (youngest)
disallowed1 = c()
keepTF1 = ranges_list %in% disallowed1 == FALSE
ranges_list_NEW1 = ranges_list[keepTF1]
length(ranges_list_NEW1)     # now 148

# STRATUM 2
ranges_to_lose = ranges_list_NEW1[grep(pattern="H", x=ranges_list)]
keepTF2 = ranges_list_NEW1 %in% ranges_to_lose == FALSE
ranges_list_NEW2 = ranges_list_NEW1[keepTF2]
ranges_list_NEW2
length(ranges_list_NEW2)

# STRATUM 3
ranges_to_lose = ranges_list_NEW2[grep(pattern="M", x=ranges_list_NEW2)]
keepTF3 = ranges_list_NEW2 %in% ranges_to_lose == FALSE
ranges_list_NEW3 = ranges_list_NEW2[keepTF3]
ranges_list_NEW3
length(ranges_list_NEW3)

# STRATUM 4 (oldest)
ranges_to_lose = ranges_list_NEW3[grep(pattern="O", x=ranges_list_NEW3)]
keepTF4 = ranges_list_NEW3 %in% ranges_to_lose == FALSE
ranges_list_NEW4 = ranges_list_NEW3[keepTF4]
ranges_list_NEW4
length(ranges_list_NEW4)

# Make the stratum-specific states list
states_list_0based_NEW1 = states_list_0based[keepTF1]
states_list_0based_NEW2 = states_list_0based_NEW1[keepTF2]
states_list_0based_NEW3 = states_list_0based_NEW2[keepTF3]
states_list_0based_NEW4 = states_list_0based_NEW3[keepTF4]
states_list_0based_NEW5 = states_list_0based_NEW4      # (copy of same, for the oldest time-bin)

# INPUT the NEW states list into the BioGeoBEARS_run_object, STRATIFIED
lists_of_states_lists_0based = list()
lists_of_states_lists_0based[[1]] = states_list_0based_NEW1
lists_of_states_lists_0based[[2]] = states_list_0based_NEW2
lists_of_states_lists_0based[[3]] = states_list_0based_NEW3
lists_of_states_lists_0based[[4]] = states_list_0based_NEW4
lists_of_states_lists_0based[[5]] = states_list_0based_NEW5

# Check it by eye (null range=NA; the islands KOMH are 0123 in 0-based numbering)
lists_of_states_lists_0based
#######################################################
# END MANUAL MODIFICATION OF THE STATES LIST
#######################################################

later in the script, make sure to have this line:

# Add the manually-constructed, time-stratified list of allowed states
BioGeoBEARS_run_object$lists_of_states_lists_0based = lists_of_states_lists_0based



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

Cheers!
Nick


 
Could you tell me if it's normal that my results show all 9 regions in that time window when I defined that only 3 were available?

Thanks!!!



--
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 view this discussion visit https://groups.google.com/d/msgid/biogeobears/b2d5cb09-9e4c-4cab-b8f5-c720155e5cd7n%40googlegroups.com.

Dora Julieth Chávarro

unread,
Mar 5, 2025, 3:51:06 PMMar 5
to bioge...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages