Change names of the *.q functions to *_q

This commit is contained in:
2019-02-08 10:45:55 +01:00
parent 657aaa734d
commit cf80ff9f6a
7 changed files with 100 additions and 73 deletions

View File

@@ -1842,13 +1842,17 @@ Environment.2
\right.
\]</p>
<pre class = 'prettyprint lang-r'>log.q = function(x,q=1) {
<pre class = 'prettyprint lang-r'>log_q = function(x,q=1) {
if (q==1)
log(x)
else
(x^(1-q)-1)/(1-q)
}</pre>
</article></slide><slide class=""><hgroup><h2>Impact of \(q\) on the <code>log_q</code> function</h2></hgroup><article id="impact-of-q-on-the-log_q-function" class="smaller ">
<p><img src="index_files/figure-html/unnamed-chunk-45-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>And its inverse function</h2></hgroup><article id="and-its-inverse-function" class="smaller flexbox vcenter">
<p>\[
@@ -1860,7 +1864,7 @@ Environment.2
\right.
\]</p>
<pre class = 'prettyprint lang-r'>exp.q = function(x,q=1) {
<pre class = 'prettyprint lang-r'>exp_q = function(x,q=1) {
if (q==1)
exp(x)
else
@@ -1873,8 +1877,8 @@ Environment.2
^qH = - \sum_{i=1}^S pi \times ^q\log pi
\]</p>
<pre class = 'prettyprint lang-r'>H.q = function(x,q=1) {
sum(x * log.q(1/x,q),na.rm = TRUE)
<pre class = 'prettyprint lang-r'>H_q = function(x,q=1) {
sum(x * log_q(1/x,q),na.rm = TRUE)
}</pre>
<p>and generalized the previously presented Hill&#39;s number</p>
@@ -1883,28 +1887,28 @@ Environment.2
^qD=^qe^{^qH}
\]</p>
<pre class = 'prettyprint lang-r'> D.q = function(x,q=1) {
exp.q(H.q(x,q),q)
<pre class = 'prettyprint lang-r'> D_q = function(x,q=1) {
exp_q(H_q(x,q),q)
}</pre>
</article></slide><slide class=""><hgroup><h2>Biodiversity spectrum (1)</h2></hgroup><article id="biodiversity-spectrum-1" class="smaller flexbox vcenter">
<pre class = 'prettyprint lang-r'>H.spectrum = function(x,q=1) {
sapply(q,function(Q) H.q(x,Q))
<pre class = 'prettyprint lang-r'>H_spectrum = function(x,q=1) {
sapply(q,function(Q) H_q(x,Q))
}</pre>
<pre class = 'prettyprint lang-r'>D.spectrum = function(x,q=1) {
sapply(q,function(Q) D.q(x,Q))
<pre class = 'prettyprint lang-r'>D_spectrum = function(x,q=1) {
sapply(q,function(Q) D_q(x,Q))
}</pre>
</article></slide><slide class=""><hgroup><h2>Biodiversity spectrum (2)</h2></hgroup><article id="biodiversity-spectrum-2" class="smaller ">
<pre class = 'prettyprint lang-r'>library(MetabarSchool)
qs = seq(from=0,to=3,by=0.1)
environments.hq = apply(environments,MARGIN = 1,H.spectrum,q=qs)
environments.dq = apply(environments,MARGIN = 1,D.spectrum,q=qs)</pre>
environments.hq = apply(environments,MARGIN = 1,H_spectrum,q=qs)
environments.dq = apply(environments,MARGIN = 1,D_spectrum,q=qs)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-51-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-52-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Generalized entropy \(vs\) \(\alpha\)-diversity indices</h2></hgroup><article id="generalized-entropy-vs-alpha-diversity-indices" class="smaller ">
@@ -1934,32 +1938,32 @@ environments.dq = apply(environments,MARGIN = 1,D.spectrum,q=qs)</pre>
</article></slide><slide class=""><hgroup><h2>Biodiversity spectrum of the mock community</h2></hgroup><article id="biodiversity-spectrum-of-the-mock-community" class="smaller ">
<pre class = 'prettyprint lang-r'>H.mock = H.spectrum(plants.16$dilution,qs)
D.mock = D.spectrum(plants.16$dilution,qs)</pre>
<pre class = 'prettyprint lang-r'>H.mock = H_spectrum(plants.16$dilution,qs)
D.mock = D_spectrum(plants.16$dilution,qs)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-53-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-54-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Biodiversity spectrum and metabarcoding (1)</h2></hgroup><article id="biodiversity-spectrum-and-metabarcoding-1" class="smaller smaller">
<pre class = 'prettyprint lang-r'>positive.H = apply(positive.count.relfreq,
MARGIN = 1,
FUN = H.spectrum,
FUN = H_spectrum,
q=qs)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-55-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-56-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Biodiversity spectrum and metabarcoding (2)</h2></hgroup><article id="biodiversity-spectrum-and-metabarcoding-2" class="smaller flexbox vcenter smaller">
<p><img src="index_files/figure-html/unnamed-chunk-56-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-57-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Biodiversity spectrum and metabarcoding (3)</h2></hgroup><article id="biodiversity-spectrum-and-metabarcoding-3" class="smaller smaller">
<pre class = 'prettyprint lang-r'>positive.D = apply(positive.count.relfreq,
MARGIN = 1,
FUN = D.spectrum,
FUN = D_spectrum,
q=qs)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-58-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-59-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Impact of data cleaning on \(\alpha\)-diversity (1)</h2></hgroup><article id="impact-of-data-cleaning-on-alpha-diversity-1" class="smaller ">
@@ -1992,19 +1996,19 @@ positive.clean.count.relfreq = decostand(positive.clean.count,
positive.clean.H = apply(positive.clean.count.relfreq,
MARGIN = 1,
FUN = H.spectrum,
FUN = H_spectrum,
q=qs)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-61-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-62-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Impact of data cleaning on \(\alpha\)-diversity (3)</h2></hgroup><article id="impact-of-data-cleaning-on-alpha-diversity-3" class="smaller ">
<pre class = 'prettyprint lang-r'>positive.clean.D = apply(positive.clean.count.relfreq,
MARGIN = 1,
FUN = D.spectrum,
FUN = D_spectrum,
q=qs)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-63-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-64-1.png" width="720" /></p>
</article></slide><slide class="segue dark nobackground level1"><hgroup class = 'auto-fadein'><h2>\(\beta\)-diversity</h2></hgroup><article id="beta-diversity" class="smaller ">
@@ -2163,7 +2167,7 @@ data(&quot;guiana.samples&quot;)</pre>
<pre class = 'prettyprint lang-r'>s = tag_bad_pcr(guiana.samples$sample,guiana.count)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-68-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-69-1.png" width="720" /></p>
<pre class = 'prettyprint lang-r'>guiana.count.clean = guiana.count[s$keep,]
guiana.samples.clean = guiana.samples[s$keep,]</pre>
@@ -2178,7 +2182,7 @@ guiana.samples.clean = guiana.samples[s$keep,]</pre>
<pre class = 'prettyprint lang-r'>s = tag_bad_pcr(guiana.samples.clean$sample,guiana.count.clean)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-70-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-71-1.png" width="720" /></p>
<pre class = 'prettyprint lang-r'>guiana.count.clean = guiana.count.clean[s$keep,]
guiana.samples.clean = guiana.samples.clean[s$keep,]</pre>
@@ -2193,7 +2197,7 @@ guiana.samples.clean = guiana.samples.clean[s$keep,]</pre>
<pre class = 'prettyprint lang-r'>s = tag_bad_pcr(guiana.samples.clean$sample,guiana.count.clean)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-72-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-73-1.png" width="720" /></p>
<pre class = 'prettyprint lang-r'>guiana.count.clean = guiana.count.clean[s$keep,]
guiana.samples.clean = guiana.samples.clean[s$keep,]</pre>
@@ -2260,7 +2264,7 @@ xy = xy[,1:2]
xy.hellinger = decostand(xy,method = &quot;hellinger&quot;)</pre>
<div style="float: left; width: 50%;">
<p><img src="index_files/figure-html/unnamed-chunk-79-1.png" width="384" /></p></div>
<p><img src="index_files/figure-html/unnamed-chunk-80-1.png" width="384" /></p></div>
<div style="float: right; width: 50%;">
<p><img src="figures/euclidean_hellinger.svg" width="400px" /></p></div>
@@ -2301,17 +2305,17 @@ guiana.jac.50.pcoa = cmdscale(guiana.jac.50.dist,k=3,eig = TRUE)</pre>
</article></slide><slide class=""><hgroup><h2>Principale coordinate analysis (2)</h2></hgroup><article id="principale-coordinate-analysis-2" class="smaller ">
<p><img src="index_files/figure-html/unnamed-chunk-82-1.png" width="720" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-83-1.png" width="720" /></p>
</article></slide><slide class=""><hgroup><h2>Principale composante analysis</h2></hgroup><article id="principale-composante-analysis" class="smaller flexbox vcenter">
<pre class = 'prettyprint lang-r'>guiana.hellinger.pca = prcomp(guiana.hellinger.final,center = TRUE, scale. = FALSE)</pre>
<p><img src="index_files/figure-html/unnamed-chunk-84-1.png" width="1152" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-85-1.png" width="1152" /></p>
</article></slide><slide class=""><hgroup><h2>Comparing diversity of the environments</h2></hgroup><article id="comparing-diversity-of-the-environments" class="smaller ">
<p><img src="index_files/figure-html/unnamed-chunk-86-1.png" width="864" /></p>
<p><img src="index_files/figure-html/unnamed-chunk-87-1.png" width="864" /></p>
</article></slide><slide class=""><hgroup><h2>Bibliography</h2></hgroup><article id="bibliography" class="smaller unnumbered">