<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Stochastic exploration of congruent models.</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>

<table width="100%" summary="page for sample.congruence.class"><tr><td>sample.congruence.class</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Stochastic exploration of congruent models.</h2>

<h3>Description</h3>

<p>Stochastic exploration of congruent models.
</p>


<h3>Usage</h3>

<pre>
sample.congruence.class(
  model,
  num.samples,
  rate.type = "both",
  sample.speciation.rates = NULL,
  sample.extinction.rates = NULL
)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>model</code></td>
<td>
<p>the reference model, an object of class &quot;CRABS&quot;</p>
</td></tr>
<tr valign="top"><td><code>num.samples</code></td>
<td>
<p>The pulled diversification rate function (measured in time before present).</p>
</td></tr>
<tr valign="top"><td><code>rate.type</code></td>
<td>
<p>either &quot;extinction&quot;, &quot;speciation&quot;, or &quot;both&quot;</p>
</td></tr>
<tr valign="top"><td><code>sample.speciation.rates</code></td>
<td>
<p>a function that when called returns a speciation rate function</p>
</td></tr>
<tr valign="top"><td><code>sample.extinction.rates</code></td>
<td>
<p>a function that when called returns a extinction rate function</p>
</td></tr>
</table>


<h3>Value</h3>

<p>A named list with congruent rates.
</p>


<h3>Examples</h3>

<pre>
data("primates_ebd")

l &lt;- approxfun(primates_ebd[["time"]], primates_ebd[["lambda"]])
mu &lt;- approxfun(primates_ebd[["time"]], primates_ebd[["mu"]])
times &lt;- primates_ebd[["time"]]

model &lt;- create.model(l, mu, primates_ebd[["time"]])

extinction_rate_samples &lt;- function(){
   res &lt;- sample.basic.models(times = times, 
                              rate0 = 0.05, 
                              model = "MRF", 
                              MRF.type = "HSMRF", 
                              fc.mean = 2.0, 
                              min.rate = 0.0, 
                              max.rate = 1.0)
   return(res)
} 

samples &lt;- sample.congruence.class(model, 
                                   num.samples = 8,
                                   rate.type = "extinction",
                                   sample.extinction.rates = extinction_rate_samples)
</pre>


</body></html>
