Question about get_inputs_for_stochastic_mapping in time-stratified DEC+J BSM (no area submergence)

12 views
Skip to first unread message

Huan Yuan

unread,
Jun 6, 2026, 10:19:41 AM (4 days ago) Jun 6
to BioGeoBEARS

Dear Dr. Matzke, 

Good day. I am YH.

I am currently using BioGeoBEARS to study the historical biogeography of insects, with a focus on quantifying dispersal rates across seven biogeographic regions under time-stratified DEC+J models.

I am writing to seek your advice on an issue I encountered when performing Biogeographic Stochastic Mapping (BSM) under a time-stratified model that includes dispersal multipliers but no area submergence. 

**My setup:**

- Six regions (A–F), all present throughout the entire evolutionary history of the clade (root age ~2.3Ga).

- Time-stratified analysis with five time bins (0–0.15, 0.15–0.4, 0.4–0.65, 0.65–1.1, 1.1–2.5 Ga).

- Dispersal multipliers were provided via `dispersal_multipliers.txt`, with each time bin having its own 6×6 matrix (no area is ever removed, only connectivity changes).

- The model runs fine for ML estimation (`bears_optim_run`), and I obtained convergent results.

 **The problem:**

When I proceed to BSM using `get_inputs_for_stochastic_mapping (res = resDECj)`, the returned list (`stochastic_mapping_inputs_list`) has `NULL` for all elements (e.g., `phy2`, `COO_weights_columnar`, `unconstr`). Consequently, `runBSM` fails because the required `stochastic_mapping_inputs_list` argument is missing or invalid.

图片1.png

I have carefully read your example script for BSM with island disappearance (http://phylo.wikidot.com/biogeographical-stochastic-mapping-example-script#BSM_script). In that example, `lists_of_states_lists_0based` is explicitly constructed by progressively removing islands that become submerged over time. 

**My question:**

For my system, where no area ever disappears (areas are only sometimes connected/disconnected), should I still construct a separate `lists_of_states_lists_0based` for each time bin?

If yes, would it be correct to set all time bins to the **same** full state list (all 2^6 − 1 ranges) rather than removing any areas? Or is there a simpler way to handle such a "connectivity-only" time-stratified BSM? 

I also noticed that in the absence of time-stratification (`timesfn` and `dispersal_multipliers_fn` commented out), `get_inputs_for_stochastic_mapping` works as expected and returns a valid list. This suggests that the problem is specifically related to how `get_inputs_for_stochastic_mapping` handles a stratified model where no area ever goes extinct. 

When I run a non-time-stratified model wothout thedispersal_multipliers.txt”,the two elements ‘phy2’, ‘COO_weights_columnar’ received feedback, the element ‘unconstr’ returned “NULL”

 图片2.png

图片3.png

**My current workaround:** I am manually aggregating dispersal events from BSM runs without time-stratification to calculate average emigration/immigration rates, but this does not allow me to examine rate changes through time. Any guidance you could provide would be greatly appreciated. 

**System information:**

- R version: [4.1.2]

- BioGeoBEARS version: [1.1.3]

- OS: [Windows 11]


Thank you very much for your time and for developing such a powerful and widely used tool.

Best regards,

YH

dispersal_multipliers.txt
ghost_timeperiods.txt
geog.data
FigTree-clade.nwk

Nick Matzke

unread,
Jun 6, 2026, 10:25:33 PM (4 days ago) Jun 6
to bioge...@googlegroups.com
Hi -- I think if no area ever disappears, you can skip the lists_of_states_lists_0based, but make sure stratified = TRUE in the BSM setup. If you do have a custom lists_of_states_lists_0based, you'd have to give it a states list for every time slice.

Also make sure the runslow and similar are set to TRUE.

If that stuff doesn't work for you, send me the files & script and I can take a look.

Cheers,
Nick


--
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/cd681262-79cc-41b6-9d7c-7a1814e44584n%40googlegroups.com.

Huan Yuan

unread,
Jun 7, 2026, 12:21:29 AM (4 days ago) Jun 7
to BioGeoBEARS
Dear Nick,

Thank you for your suggestions.

I tried both:
1. commenting `lists_of_states_lists_0based`
2. Adding `stratified = TRUE` to `runBSM()`

Unfortunately, the problem persists. `get_inputs_for_stochastic_mapping()` still returns NULL for all elements (phy2, COO_weights_columnar, etc.), and `runBSM()` fails.

I am attaching my files & scripts (tree, geography, timeperiods, multipliers, and script) here.

Please take a look when you have time.

Thank you again for your help.

Best regards,
YH
myinputcopy.zip
Reply all
Reply to author
Forward
0 new messages