d.rel.conn.unif.prior: Estimate the probability distribution of relative...

Description Usage Arguments Details Value Functions Author(s) References See Also Examples

View source: R/connectivity_estimation.R

Description

These functions calculate the probability density function (d.rel.conn.unif.prior), the probability distribution function (aka the cumulative distribution function; p.rel.conn.unif.prior) and the quantile function (q.rel.conn.unif.prior) for the relative (to all settlers at the destination site) connectivity value for larval transport between a source and destination site given a known fraction of marked individuals (i.e., eggs) in the source population. A uniform prior is used for the relative connectivity value.

Usage

1
2
3
4
5

Arguments

phi

Vector of fractions of individuals (i.e., eggs) from the source population settling at the destination population

p

Fraction of individuals (i.e., eggs) marked in the source population

k

Number of marked settlers found in sample

n

Total number of settlers collected

log

If TRUE, returns natural logarithm of probabilities, except for q.rel.conn.unif.prior, which expects log of probabilities as inputs

...

Extra arguments to Beta distribution functions. See dbeta for details. For expert use only.

q

Vector of quantiles

Details

Estimations of the probability distribution are derived from the Beta distribution (see dbeta) and should be exact to great precision.

Value

Vector of probabilities or quantiles.

Functions

Author(s)

David M. Kaplan dmkaplan2000@gmail.com

References

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.

See Also

Other connectivity estimation: d.rel.conn.beta.prior(), d.rel.conn.dists.func(), d.rel.conn.finite.settlement(), d.rel.conn.multinomial.unnorm(), d.rel.conn.multiple(), dual.mark.transmission(), optim.rel.conn.dists(), r.marked.egg.fraction()

Examples

 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
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")

dmkaplan2000/ConnMatTools documentation built on Feb. 8, 2020, 4:41 p.m.