This function calculates the number of columns (lengths) in the jump matrix for each chain within the outputs object and compiles the results into a data frame. It also creates a sorted frequency table of the unique lengths in descending order.

get_lengths(outputs, n_chain)

Arguments

outputs

List. A list containing the jump matrices for all chains. Typically, this is the output from an RJMCMC process.

n_chain

Integer. The number of chains to process.

Value

A named vector representing the sorted frequency table of column lengths across all chains.

Details

The function iterates through each chain in the range 1:n_chain. For each chain, it calculates the number of columns in each jump matrix stored in outputs$jump. These lengths are compiled into a data frame with two columns:

  • chain: The chain index.

  • length_n: The number of columns in the jump matrix for that chain.

Finally, it creates a frequency table of the length_n values and sorts it in descending order, allowing the user to see the most common lengths of jump matrices.