d.rel.conn.finite.settlement: Estimate the probability distribution for the number of...

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

View source: R/connectivity_estimation.finite_settlement.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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)

Arguments

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 <=n.settlers.

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 n.obs (<=n.settlers) settlers are collected

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 n.settlers+1. Defaults to 1.

q

Vector of quantiles

Details

The relative connectivity between the source and destination sites is calculated as n.origin/n.settlers.

Value

A 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.multinomial.unnorm(), d.rel.conn.multiple(), d.rel.conn.unif.prior(), 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.