d.rel.conn.finite.settlement {ConnMatTools} | R Documentation |
These functions calculate the probability mass function
(d.rel.conn.finite.settlement
), the cumulative distribution function
(p.rel.conn.finite.settlement
) and the quantile function
(q.rel.conn.finite.settlement
) for the true number of settlers at a
site that originated in a particular site given a known fraction of marked
eggs among the eggs originating at the source site, a sample of settlers at
the destination site, a known fraction of which are marked, and a finite
settler pool of known size.
d.rel.conn.finite.settlement(
n.origin,
p,
k,
n.obs,
n.settlers,
prior.n.origin = 1
)
p.rel.conn.finite.settlement(
n.origin,
p,
k,
n.obs,
n.settlers,
prior.n.origin = 1
)
q.rel.conn.finite.settlement(q, p, k, n.obs, n.settlers, prior.n.origin = 1)
n.origin |
Vector of integers of possible numbers of settlers in the
cohort that originated at the site of marking. All values should be
integers |
p |
Fraction of individuals (i.e., eggs) marked in the source population |
k |
Number of marked settlers in sample |
n.obs |
Total number of settlers collected |
n.settlers |
Total number of settlers at the destination site from which
the |
prior.n.origin |
A prior probability mass function for the number of
settlers in the cohort originating at the site of marking. Must be a scalar
or a vector of length |
q |
Vector of quantiles |
The relative connectivity between the source and destination sites is
calculated as n.origin/n.settlers
.
A vector of probabilities or quantiles.
d.rel.conn.finite.settlement
: Returns the probability mass
function for the numbers of settlers in the cohort that originated at the
source site (i.e., site of marking).
p.rel.conn.finite.settlement
: Returns the cumulative distribution
function for the numbers of settlers in the cohort that originated at the
source site (i.e., site of marking).
q.rel.conn.finite.settlement
: Returns quantiles of the cumulative
distribution function for the numbers of settlers in the cohort that
originated at the source site (i.e., site of marking).
David M. Kaplan dmkaplan2000@gmail.com
Kaplan DM, Cuif M, Fauvelot C, Vigliola L, Nguyen-Huu T, Tiavouane J and Lett C (in press) Uncertainty in empirical estimates of marine larval connectivity. ICES Journal of Marine Science. doi:10.1093/icesjms/fsw182.
Other connectivity estimation:
d.rel.conn.beta.prior()
,
d.rel.conn.dists.func()
,
d.rel.conn.multinomial.unnorm()
,
d.rel.conn.multiple()
,
d.rel.conn.unif.prior()
,
dual.mark.transmission()
,
optim.rel.conn.dists()
,
r.marked.egg.fraction()
library(ConnMatTools)
k <- 10 # Number of marked settlers among sample
n.obs <- 87 # Number of settlers in sample
n.settlers <- 100 # Total size of settler pool
p <- 0.4 # Fraction of eggs that was marked
phi <- seq(0,1,length.out=101) # Values for relative connectivity
# Probability distribution assuming infinite settler pool and uniform prior
drc <- d.rel.conn.unif.prior(phi,p,k,n.obs)
prc <- p.rel.conn.unif.prior(phi,p,k,n.obs)
qrc <- q.rel.conn.unif.prior(c(0.025,0.975),p,k,n.obs) # 95% confidence interval
# Test with finite settlement function and large (approx. infinite) settler pool
# Can be a bit slow for large settler pools
dis <- d.rel.conn.finite.settlement(0:(7*n.obs),p,k,n.obs,7*n.obs)
# Quantiles
qis <- q.rel.conn.finite.settlement(c(0.025,0.975),p,k,n.obs,7*n.obs)
# Finite settler pool
dfs <- d.rel.conn.finite.settlement(0:n.settlers,p,k,n.obs,n.settlers)
# Quantiles for the finite settler pool
qfs <- q.rel.conn.finite.settlement(c(0.025,0.975),p,k,n.obs,n.settlers)
# Make a plot of different distributions
plot(phi,drc,type="l",main="Probability of relative connectivity values",
xlab=expression(phi),ylab="Probability density")
lines(phi,prc,col="blue")
lines((0:(7*n.obs))/(7*n.obs),dis*(7*n.obs),col="black",lty="dashed")
lines((0:n.settlers)/n.settlers,dfs*n.settlers,col="red",lty="dashed")
abline(v=qrc,col="black")
abline(v=qis/(7*n.obs),col="black",lty="dashed")
abline(v=qfs/n.settlers,col="red",lty="dashed")