manual states problem / solution

56 views
Skip to first unread message

Nick Matzke

unread,
Apr 11, 2024, 6:25:25 PM4/11/24
to BioGeoBEARS
Hi,

A user was getting this error when manually modifying the states list:

On trying bears_optim_run, they got:

===========
STOP ERROR in calc_loglike_sp_prebyte(): Some inputs have incorrect size -- numstates_in_tip_condlikes_of_data_on_each_state: 10 numstates_in_spPmat_inputs_states_indices+1: 11 numstates_in_Qmat: 11
Error in calc_loglike_sp(tip_condlikes_of_data_on_each_state = tip_condlikes_of_data_on_each_state, :
===========

This was the solution:

======================================
You had:

# Set the maximum number of areas any species may occupy; this cannot be larger
# than the number of areas you set up, but it can be smaller.
max_range_size = 2

...then...

# Input the maximum range size
BioGeoBEARS_run_object$max_range_size = max_range_size

...then...

max_range_size = 3
areas = getareas_from_tipranges_object(tipranges)
#areas = c("D" "P" "C" "S" "B")

# 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)


If you change the first max_range_size = 2 to max_range_size = 3 it works -- then you are modifying the correct initial list of states, then the length of the states_list comes out correct in all parts of the run object, and the error goes away.
======================================

Cheers,
Nick

Reply all
Reply to author
Forward
0 new messages