Dynamic community occupancy modeling with R and JAGS

[This article was first published on Ecology in silico, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post is intended to provide a simple example of how to construct and make inferences on a multi-species multi-year occupancy model using R, JAGS, and the ‘rjags’ package. This is not intended to be a standalone tutorial on dynamic community occupancy modeling. Useful primary literature references include MacKenzie et al. (2002), Kery and Royle (2007), Royle and Kery (2007), Russell et al. (2009), and Dorazio et al. (2010). Royle and Dorazio’s Heirarchichal Modeling and Inference in Ecology also provides a clear explanation of simple one species occupancy models, multispecies occupancy models, and dynamic (multiyear) occupancy models, among other things. There’s also a wealth of code provided here by Elise Zipkin, J. Andrew Royle, and others.

Before getting started, we can define two convenience functions:

1
2
3
4
5
6
7
<span class="line">logit <span class="o"><-</span> <span class="kr">function</span><span class="p">(</span>x<span class="p">)</span> <span class="p">{</span>
</span><span class="line">    log<span class="p">(</span>x<span class="o">/</span><span class="p">(</span><span class="m">1</span> <span class="o">-</span> x<span class="p">))</span>
</span><span class="line"><span class="p">}</span>
</span><span class="line">
</span><span class="line">antilogit <span class="o"><-</span> <span class="kr">function</span><span class="p">(</span>x<span class="p">)</span> <span class="p">{</span>
</span><span class="line">    exp<span class="p">(</span>x<span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="m">1</span> <span class="o">+</span> exp<span class="p">(</span>x<span class="p">))</span>
</span><span class="line"><span class="p">}</span>
</span>

Then, initializing the number of sites, species, years, and repeat surveys (i.e. surveys within years, where the occupancy status of a site is assumed to be constant),

1
2
3
4
<span class="line">nsite <span class="o"><-</span> <span class="m">150</span>
</span><span class="line">nspec <span class="o"><-</span> <span class="m">6</span>
</span><span class="line">nyear <span class="o"><-</span> <span class="m">4</span>
</span><span class="line">nrep <span class="o"><-</span> <span class="m">3</span>
</span>

we can begin to consider occupancy. We’re interested in making inferences about the rates of colonization and population persistence for each species in a community, while estimating and accounting for imperfect detection.

Occupancy status at site $j$, by species $i$, in year $t$ is represented by $z(j,i,t)$. For occupied sites $z=1$; for unoccupied sites $z=0$. However, $Z$ is incompletely observed: it is possible that a species $i$ is present at a site $j$ in some year $t$ ($z(j,i,t)=1$) but species $i$ was never seen at at site $j$ in year $t$ across all $k$ repeat surveys because of imperfect detection. These observations are represented by $x(j,i,t,k)$. Here we assume that there are no “false positive” observations. In other words, if $\sum_{1}^{k}x(j,i,t,k)>0$ , then $z(j,i,t)=1$. If a site is occupied, the probability that $x(j,i,t,k)=1$ is represented as a Bernoulli trial with probability of detection $p(j,i,t,k)$, such that

The occupancy status $z$ of species $i$ at site $j$ in year $t$ is modeled as a Markov Bernoulli trial. In other words whether a species is present at a site in year $t$ is influenced by whether it was present at year $t−1$.
$$
z(j,i,t) \sim Bernoulli(ψj,i,t)
$$

where for $t>1$

and in year one $(t=1)$

where the occupancy status in year 0, , and . and are parameters that control the probabilities of colonization and persistence. If a site was unoccupied by species in a previous year , then the probability of colonization is given by the antilogit of . If a site was previously occupied , the probability of population persistence is given by the anitlogit of . We assume that the distributions of species specific parameters are defined by community level hyperparameters such that and . We can generate occupancy data as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<span class="line"><span class="c1"># community level hyperparameters</span>
</span><span class="line">p_beta <span class="o">=</span> <span class="m">0.7</span>
</span><span class="line">mubeta <span class="o"><-</span> logit<span class="p">(</span>p_beta<span class="p">)</span>
</span><span class="line">sdbeta <span class="o"><-</span> <span class="m">2</span>
</span><span class="line">
</span><span class="line">p_rho <span class="o"><-</span> <span class="m">0.8</span>
</span><span class="line">murho <span class="o"><-</span> logit<span class="p">(</span>p_rho<span class="p">)</span>
</span><span class="line">sdrho <span class="o"><-</span> <span class="m">1</span>
</span><span class="line">
</span><span class="line"><span class="c1"># species specific random effects</span>
</span><span class="line">set.seed<span class="p">(</span><span class="m">1</span><span class="p">)</span>  <span class="c1"># for reproducibility</span>
</span><span class="line">beta <span class="o"><-</span> rnorm<span class="p">(</span>nspec<span class="p">,</span> mubeta<span class="p">,</span> sdbeta<span class="p">)</span>
</span><span class="line">set.seed<span class="p">(</span><span class="m">1008</span><span class="p">)</span>
</span><span class="line">rho <span class="o"><-</span> rnorm<span class="p">(</span>nspec<span class="p">,</span> murho<span class="p">,</span> sdrho<span class="p">)</span>
</span><span class="line">
</span><span class="line"><span class="c1"># initial occupancy states</span>
</span><span class="line">set.seed<span class="p">(</span><span class="m">237</span><span class="p">)</span>
</span><span class="line">rho0 <span class="o"><-</span> runif<span class="p">(</span>nspec<span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">)</span>
</span><span class="line">z0 <span class="o"><-</span> array<span class="p">(</span>dim <span class="o">=</span> c<span class="p">(</span>nsite<span class="p">,</span> nspec<span class="p">))</span>
</span><span class="line"><span class="kr">for</span> <span class="p">(</span>i <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nspec<span class="p">)</span> <span class="p">{</span>
</span><span class="line">    z0<span class="p">[,</span> i<span class="p">]</span> <span class="o"><-</span> rbinom<span class="p">(</span>nsite<span class="p">,</span> <span class="m">1</span><span class="p">,</span> rho0<span class="p">[</span>i<span class="p">])</span>
</span><span class="line"><span class="p">}</span>
</span><span class="line">
</span><span class="line"><span class="c1"># subsequent occupancy</span>
</span><span class="line">z <span class="o"><-</span> array<span class="p">(</span>dim <span class="o">=</span> c<span class="p">(</span>nsite<span class="p">,</span> nspec<span class="p">,</span> nyear<span class="p">))</span>
</span><span class="line">lpsi <span class="o"><-</span> array<span class="p">(</span>dim <span class="o">=</span> c<span class="p">(</span>nsite<span class="p">,</span> nspec<span class="p">,</span> nyear<span class="p">))</span>
</span><span class="line">psi <span class="o"><-</span> array<span class="p">(</span>dim <span class="o">=</span> c<span class="p">(</span>nsite<span class="p">,</span> nspec<span class="p">,</span> nyear<span class="p">))</span>
</span><span class="line"><span class="kr">for</span> <span class="p">(</span>j <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nsite<span class="p">)</span> <span class="p">{</span>
</span><span class="line">    <span class="kr">for</span> <span class="p">(</span>i <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nspec<span class="p">)</span> <span class="p">{</span>
</span><span class="line">        <span class="kr">for</span> <span class="p">(</span>t <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nyear<span class="p">)</span> <span class="p">{</span>
</span><span class="line">            <span class="kr">if</span> <span class="p">(</span>t <span class="o">==</span> <span class="m">1</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line">                lpsi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> beta<span class="p">[</span>i<span class="p">]</span> <span class="o">+</span> rho<span class="p">[</span>i<span class="p">]</span> <span class="o">*</span> z0<span class="p">[</span>j<span class="p">,</span> i<span class="p">]</span>
</span><span class="line">                psi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> antilogit<span class="p">(</span>lpsi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">])</span>
</span><span class="line">                z<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> rbinom<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">1</span><span class="p">,</span> psi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">])</span>
</span><span class="line">            <span class="p">}</span> <span class="kr">else</span> <span class="p">{</span>
</span><span class="line">                lpsi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> beta<span class="p">[</span>i<span class="p">]</span> <span class="o">+</span> rho<span class="p">[</span>i<span class="p">]</span> <span class="o">*</span> z<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t <span class="o">-</span> <span class="m">1</span><span class="p">]</span>
</span><span class="line">                psi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> antilogit<span class="p">(</span>lpsi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">])</span>
</span><span class="line">                z<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> rbinom<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">1</span><span class="p">,</span> psi<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">])</span>
</span><span class="line">            <span class="p">}</span>
</span><span class="line">        <span class="p">}</span>
</span><span class="line">    <span class="p">}</span>
</span><span class="line"><span class="p">}</span>
</span>

For simplicity, we’ll assume that there are no differences in species detectability among sites, years, or repeat surveys, but that detectability varies among species. We’ll again use hyperparameters to specify a distribution of detection probabilities in our community, such that .

1
2
3
4
5
6
<span class="line">p_p <span class="o"><-</span> <span class="m">0.7</span>
</span><span class="line">mup <span class="o"><-</span> logit<span class="p">(</span>p_p<span class="p">)</span>
</span><span class="line">sdp <span class="o"><-</span> <span class="m">1.5</span>
</span><span class="line">set.seed<span class="p">(</span><span class="m">222</span><span class="p">)</span>
</span><span class="line">lp <span class="o"><-</span> rnorm<span class="p">(</span>nspec<span class="p">,</span> mup<span class="p">,</span> sdp<span class="p">)</span>
</span><span class="line">p <span class="o"><-</span> antilogit<span class="p">(</span>lp<span class="p">)</span>
</span>

We can now generate our observations based on occupancy states and detection probabilities. Although this could be vectorized for speed, let’s stick with nested for loops in the interest of clarity.

1
2
3
4
5
6
7
8
9
10
<span class="line">x <span class="o"><-</span> array<span class="p">(</span>dim <span class="o">=</span> c<span class="p">(</span>nsite<span class="p">,</span> nspec<span class="p">,</span> nyear<span class="p">,</span> nrep<span class="p">))</span>
</span><span class="line"><span class="kr">for</span> <span class="p">(</span>j <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nsite<span class="p">)</span> <span class="p">{</span>
</span><span class="line">    <span class="kr">for</span> <span class="p">(</span>i <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nspec<span class="p">)</span> <span class="p">{</span>
</span><span class="line">        <span class="kr">for</span> <span class="p">(</span>t <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nyear<span class="p">)</span> <span class="p">{</span>
</span><span class="line">            <span class="kr">for</span> <span class="p">(</span>k <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nrep<span class="p">)</span> <span class="p">{</span>
</span><span class="line">                x<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">,</span> k<span class="p">]</span> <span class="o"><-</span> rbinom<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">1</span><span class="p">,</span> p<span class="p">[</span>i<span class="p">]</span> <span class="o">*</span> z<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">])</span>
</span><span class="line">            <span class="p">}</span>
</span><span class="line">        <span class="p">}</span>
</span><span class="line">    <span class="p">}</span>
</span><span class="line"><span class="p">}</span>
</span>

Now that we’ve collected some data, we can specify our model:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<span class="line">cat<span class="p">(</span><span class="s">"</span>
</span><span class="line"><span class="s">model{</span>
</span><span class="line"><span class="s">  #### priors</span>
</span><span class="line"><span class="s">  # beta hyperparameters</span>
</span><span class="line"><span class="s">  p_beta ~ dbeta(1, 1)</span>
</span><span class="line"><span class="s">	mubeta <- log(p_beta / (1 - p_beta))</span>
</span><span class="line"><span class="s">  sigmabeta ~ dunif(0, 10)</span>
</span><span class="line"><span class="s">  taubeta <- (1 / (sigmabeta * sigmabeta))</span>
</span><span class="line">
</span><span class="line"><span class="s">  # rho hyperparameters</span>
</span><span class="line"><span class="s">  p_rho ~ dbeta(1, 1)</span>
</span><span class="line"><span class="s">	murho <- log(p_rho / (1 - p_rho))</span>
</span><span class="line"><span class="s">	sigmarho~dunif(0,10)</span>
</span><span class="line"><span class="s">	taurho<-1/(sigmarho*sigmarho)</span>
</span><span class="line">
</span><span class="line"><span class="s">  # p hyperparameters</span>
</span><span class="line"><span class="s">  p_p ~ dbeta(1, 1)</span>
</span><span class="line"><span class="s">  mup <- log(p_p / (1 - p_p))</span>
</span><span class="line"><span class="s">  sigmap ~ dunif(0,10)</span>
</span><span class="line"><span class="s">  taup <- (1 / (sigmap * sigmap))</span>
</span><span class="line">
</span><span class="line"><span class="s">  #### occupancy model</span>
</span><span class="line"><span class="s">  # species specific random effects</span>
</span><span class="line"><span class="s">  for (i in 1:(nspec)) {</span>
</span><span class="line"><span class="s">    rho0[i] ~ dbeta(1, 1)</span>
</span><span class="line"><span class="s">    beta[i] ~ dnorm(mubeta, taubeta)</span>
</span><span class="line"><span class="s">    rho[i] ~ dnorm(murho, taurho)</span>
</span><span class="line"><span class="s">  }</span>
</span><span class="line"><span class="s">  </span>
</span><span class="line"><span class="s">  # occupancy states</span>
</span><span class="line"><span class="s">  for (j in 1:nsite) {</span>
</span><span class="line"><span class="s">    for (i in 1:nspec) {</span>
</span><span class="line"><span class="s">      z0[j, i] ~ dbern(rho0[i])</span>
</span><span class="line"><span class="s">      logit(psi[j, i, 1]) <- beta[i] + rho[i] * z0[j, i] </span>
</span><span class="line"><span class="s">      z[j, i, 1] ~ dbern(psi[j, i, 1]) </span>
</span><span class="line"><span class="s">      for (t in 2:nyear) {</span>
</span><span class="line"><span class="s">        logit(psi[j, i, t]) <- beta[i] + rho[i] * z[j, i, t-1]</span>
</span><span class="line"><span class="s">        z[j, i, t] ~ dbern(psi[j, i, t])</span>
</span><span class="line"><span class="s">      }</span>
</span><span class="line"><span class="s">    }</span>
</span><span class="line"><span class="s">  }</span>
</span><span class="line">
</span><span class="line"><span class="s">  #### detection model</span>
</span><span class="line"><span class="s">	for(i in 1:nspec){ </span>
</span><span class="line"><span class="s">		lp[i] ~ dnorm(mup, taup)</span>
</span><span class="line"><span class="s">		p[i] <- (exp(lp[i])) / (1 + exp(lp[i]))</span>
</span><span class="line"><span class="s">	}</span>
</span><span class="line"><span class="s">	</span>
</span><span class="line"><span class="s">  #### observation model</span>
</span><span class="line"><span class="s">  for (j in 1:nsite){</span>
</span><span class="line"><span class="s">    for (i in 1:nspec){</span>
</span><span class="line"><span class="s">      for (t in 1:nyear){</span>
</span><span class="line"><span class="s">        mu[j, i, t] <- z[j, i, t] * p[i] </span>
</span><span class="line"><span class="s">        for (k in 1:nrep){</span>
</span><span class="line"><span class="s">          x[j, i, t, k] ~ dbern(mu[j, i, t])</span>
</span><span class="line"><span class="s">        }</span>
</span><span class="line"><span class="s">      }</span>
</span><span class="line"><span class="s">    }</span>
</span><span class="line"><span class="s">  }</span>
</span><span class="line"><span class="s">}</span>
</span><span class="line"><span class="s">"</span><span class="p">,</span> fill<span class="o">=</span><span class="kc">TRUE</span><span class="p">,</span> file<span class="o">=</span><span class="s">"com_occ.txt"</span><span class="p">)</span>
</span>

Next, bundle up the data.

1
<span class="line">data <span class="o"><-</span> list<span class="p">(</span>x <span class="o">=</span> x<span class="p">,</span> nrep <span class="o">=</span> nrep<span class="p">,</span> nsite <span class="o">=</span> nsite<span class="p">,</span> nspec <span class="o">=</span> nspec<span class="p">,</span> nyear <span class="o">=</span> nyear<span class="p">)</span>
</span>

Provide initial values.

1
2
3
4
5
6
7
8
9
10
11
12
13
<span class="line">zinit <span class="o"><-</span> array<span class="p">(</span>dim <span class="o">=</span> c<span class="p">(</span>nsite<span class="p">,</span> nspec<span class="p">,</span> nyear<span class="p">))</span>
</span><span class="line"><span class="kr">for</span> <span class="p">(</span>j <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nsite<span class="p">)</span> <span class="p">{</span>
</span><span class="line">    <span class="kr">for</span> <span class="p">(</span>i <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nspec<span class="p">)</span> <span class="p">{</span>
</span><span class="line">        <span class="kr">for</span> <span class="p">(</span>t <span class="kr">in</span> <span class="m">1</span><span class="o">:</span>nyear<span class="p">)</span> <span class="p">{</span>
</span><span class="line">            zinit<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">]</span> <span class="o"><-</span> max<span class="p">(</span>x<span class="p">[</span>j<span class="p">,</span> i<span class="p">,</span> t<span class="p">,</span> <span class="p">])</span>
</span><span class="line">        <span class="p">}</span>
</span><span class="line">    <span class="p">}</span>
</span><span class="line"><span class="p">}</span>
</span><span class="line">
</span><span class="line">inits <span class="o"><-</span> <span class="kr">function</span><span class="p">()</span> <span class="p">{</span>
</span><span class="line">    list<span class="p">(</span>p_beta <span class="o">=</span> runif<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span> p_rho <span class="o">=</span> runif<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span> sigmarho <span class="o">=</span> runif<span class="p">(</span><span class="m">1</span><span class="p">,</span>
</span><span class="line">        <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span> sigmap <span class="o">=</span> runif<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">10</span><span class="p">),</span> sigmabeta <span class="o">=</span> runif<span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">10</span><span class="p">),</span> z <span class="o">=</span> zinit<span class="p">)</span>
</span><span class="line"><span class="p">}</span>
</span>

As a side note, it is helpful in JAGS to provide initial values for the incompletely observed occupancy state $z$ that are consistent with observed presences, as provided in this example with zinit. In other words if $x(j,i,t,k)=1$, provide an intial value of 1 for $z(j,i,t)$. Unlike WinBUGS and OpenBUGS, if you do not do this, you’ll often (but not always) encounter an error message such as:

1
2
3
<span class="line"><span class="c1"># Error in jags.model(file = 'com_occ.txt', data = data, n.chains = 3) :</span>
</span><span class="line"><span class="c1"># Error in node x[1,1,2,3] Observed node inconsistent with unobserved</span>
</span><span class="line"><span class="c1"># parents at initialization</span>
</span>

Now we’re ready to monitor and make inferences about some parameters of interest using JAGS.

1
2
3
4
5
6
7
8
<span class="line">params <span class="o"><-</span> c<span class="p">(</span><span class="s">"lp"</span><span class="p">,</span> <span class="s">"beta"</span><span class="p">,</span> <span class="s">"rho"</span><span class="p">)</span>
</span><span class="line">require<span class="p">(</span>rjags<span class="p">)</span>
</span><span class="line">ocmod <span class="o"><-</span> jags.model<span class="p">(</span>file <span class="o">=</span> <span class="s">"com_occ.txt"</span><span class="p">,</span> inits <span class="o">=</span> inits<span class="p">,</span> data <span class="o">=</span> data<span class="p">,</span> n.chains <span class="o">=</span> <span class="m">3</span><span class="p">)</span>
</span><span class="line">nburn <span class="o"><-</span> <span class="m">2000</span>
</span><span class="line">update<span class="p">(</span>ocmod<span class="p">,</span> n.iter <span class="o">=</span> nburn<span class="p">)</span>
</span><span class="line">out <span class="o"><-</span> coda.samples<span class="p">(</span>ocmod<span class="p">,</span> n.iter <span class="o">=</span> <span class="m">17000</span><span class="p">,</span> variable.names <span class="o">=</span> params<span class="p">)</span>
</span><span class="line">summary<span class="p">(</span>out<span class="p">)</span>
</span><span class="line">plot<span class="p">(</span>out<span class="p">)</span>
</span>



At this point, you’ll want to run through the usual MCMC diagnostics to check for convergence and adjust the burn-in or number of iterations accordingly. Once satisfied, we can check to see how well our model performed based on our known parameter values.

1
2
3
<span class="line">require<span class="p">(</span>mcmcplots<span class="p">)</span>
</span><span class="line">caterplot<span class="p">(</span>out<span class="p">,</span> <span class="s">"beta"</span><span class="p">,</span> style <span class="o">=</span> <span class="s">"plain"</span><span class="p">)</span>
</span><span class="line">caterpoints<span class="p">(</span>beta<span class="p">)</span>
</span>

1
2
<span class="line">caterplot<span class="p">(</span>out<span class="p">,</span> <span class="s">"lp"</span><span class="p">,</span> style <span class="o">=</span> <span class="s">"plain"</span><span class="p">)</span>
</span><span class="line">caterpoints<span class="p">(</span>lp<span class="p">)</span>
</span>

1
2
<span class="line">caterplot<span class="p">(</span>out<span class="p">,</span> <span class="s">"rho"</span><span class="p">,</span> style <span class="o">=</span> <span class="s">"plain"</span><span class="p">)</span>
</span><span class="line">caterpoints<span class="p">(</span>rho<span class="p">)</span>
</span>

To leave a comment for the author, please follow the link and comment on their blog: Ecology in silico.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)