Description Usage Arguments Author(s) Examples
View source: R/mbd_loglik_utils.R
Function to build a matrix, used in creating the A and B operators. It produces the structure q ^ (m - n) * (1 - q) ^ (k + 2 * n-m) * sum_j 2 ^ j choose(k, j) * choose(n, m - n - j)
1 | hyper_matrix0(n_species, k, q)
|
n_species |
number of species. |
k |
the number of visible species in the phylogeny at a given time. |
q |
the single-lineage speciation probability at a triggered event. |
Hanno Hildenbrandt, adapted by Richel J.C. Bilderbeek
1 2 3 4 5 6 7 8 9 10 | m <- mbd::hyper_matrix0(n_species = 2, k = 2, q = 0.1)
testthat::expect_equal(m[1, 1], 0.81)
testthat::expect_equal(m[1, 2], 0.00)
testthat::expect_equal(m[1, 3], 0.00)
testthat::expect_equal(m[2, 1], 0.36)
testthat::expect_equal(m[2, 2], 0.729)
testthat::expect_equal(m[2, 3], 0.00)
testthat::expect_equal(m[3, 1], 0.04)
testthat::expect_equal(m[3, 2], 0.405)
testthat::expect_equal(m[3, 3], 0.6561)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.