<!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 for all samples in...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="https://rpkg.net/assets/examples.css" />
</head><body>

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

<h2>Stochastic exploration of congruent models for all samples in the posterior</h2>

<h3>Description</h3>

<p>This function takes a posterior sample as input: a list of ACDC objects. 
It will then iterate over the samples, and for each posterior sample it will
sample from the posterior class. It will sample using the <code>sample.basic.models</code>
function, and all additional parameters are passed to <code>sample.basic.models</code>.
</p>


<h3>Usage</h3>

<pre>
sample.congruence.class.posterior(
  posterior,
  num.samples,
  rate.type = "extinction",
  ...
)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>posterior</code></td>
<td>
<p>a list of ACDC model objects</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>...</code></td>
<td>

<p>Arguments passed on to <code>sample.basic.models</code>
</p>

<dl>
<dt><code>times</code></dt><dd><p>the time knots</p>
</dd>
<dt><code>rate0</code></dt><dd><p>The rate at present, otherwise drawn randomly.</p>
</dd>
<dt><code>model</code></dt><dd><p>&quot;MRF&quot; for pure MRF model, otherwise MRF has a trend of type &quot;exponential&quot;,&quot;linear&quot;, or &quot;episodic&lt;n&gt;&quot;</p>
</dd>
<dt><code>direction</code></dt><dd><p>&quot;increase&quot; or &quot;decrease&quot; (measured in past to present)</p>
</dd>
<dt><code>noisy</code></dt><dd><p>If FALSE, no MRF noise is added to the trajectory</p>
</dd>
<dt><code>MRF.type</code></dt><dd><p>&quot;HSMRF&quot; or &quot;GMRF&quot;, type for stochastic noise.</p>
</dd>
<dt><code>monotonic</code></dt><dd><p>Whether the curve should be forced to always move in one direction.</p>
</dd>
<dt><code>fc.mean</code></dt><dd><p>Determines the average amount of change when drawing from the model.</p>
</dd>
<dt><code>rate0.median</code></dt><dd><p>When not specified, rate at present is drawn from a lognormal distribution with this median.</p>
</dd>
<dt><code>rate0.logsd</code></dt><dd><p>When not specified, rate at present is drawn from a lognormal distribution with this sd</p>
</dd>
<dt><code>min.rate</code></dt><dd><p>The minimum rate (rescaling fone after after drawing rates).</p>
</dd>
<dt><code>max.rate</code></dt><dd><p>The maximum rate (rescaling fone after after drawing rates).</p>
</dd>
</dl>
</td></tr>
</table>


<h3>Value</h3>

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


<h3>Examples</h3>

<pre>
data(primates_ebd_log)

posterior &lt;- read.RevBayes(primates_ebd_log, max_t = 65, n_samples = 20)

samples &lt;- sample.congruence.class.posterior(posterior, 
                                             num.samples = 20,
                                             rate.type = "extinction",
                                             rate0.median = 0.1,
                                             model = "MRF",
                                             max.rate = 1.0)

print(samples)
</pre>


</body></html>
