Functions for estimating the probability distribution of relative connectivity values as a weighted sum over possible input parameters

Description

These functions calculate the probability density function (d.rel.conn.multiple), the probability distribution function (aka the cumulative distribution function; p.rel.conn.multiple) and the quantile function (q.rel.conn.multiple) for the relative (to all settlers at the destination site) connectivity value for larval transport between a source and destination site. This version allows one to input multiple possible fractions of individuals (i.e., eggs) marked at the source site, multiple possible numbers of settlers collected and multiple possible marked individuals observed in the sample. This gives one the possibility to produce ensemble averages over different input parameter values with different probabilities of being correct.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
d.rel.conn.multiple(phi, ps, ks, ns, weights = 1,
  d.rel.conn = d.rel.conn.beta.prior, ...)

p.rel.conn.multiple(phi, ps, ks, ns, weights = 1,
  p.rel.conn = p.rel.conn.beta.prior, ...)

q.rel.conn.multiple.func(ps, ks, ns, weights = 1,
  p.rel.conn = p.rel.conn.beta.prior, N = 1000, ...)

q.rel.conn.multiple(q, ps, ks, ns, weights = 1,
  p.rel.conn = p.rel.conn.beta.prior, N = 1000, ...)

Arguments

phi

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

ps

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

ks

Vector of numbers of marked settlers found in sample

ns

Vector of total numbers of settlers collected

weights

Vector of weights for each set of p, k and n values

d.rel.conn

Function to use to calculate probability density for individual combinations of ps, ks and ns. Defaults to d.rel.conn.beta.prior. Could also be d.rel.conn.unif.prior.

p.rel.conn

Function to use to calculate cumulative probability distribution for individual combinations of ps, ks and ns. Defaults to p.rel.conn.beta.prior. Could also be p.rel.conn.unif.prior.

N

Number of points at which to estimate cumulative probability function for reverse approximation of quantile distribution. Defaults to 1000.

q

Vector of quantiles

...

Additional arguments for the function d.rel.conn or p.rel.conn

Details

If ps, ks, ns and weights can be scalars or vectors of the same length (or lengths divisible into that of the largest input parameter). weights are normalized to sum to 1 before being used to sum probabilities from each individual set of input parameters.

Value

Vector of probabilities or quantiles, or a function in the case of q.rel.conn.multiple.func

Functions

  • d.rel.conn.multiple: Estimates quantiles for the probability distribution function for relative connectivity between a pair of sites for multiple possible p, k and n values.

  • p.rel.conn.multiple: Estimates the cumulative probability distribution for relative connectivity between a paire of sites for multiple possible p, k and n values.

  • q.rel.conn.multiple.func: Returns a function to estimate quantiles for the probability distribution function for relative connectivity between a pair of sites for multiple possible p, k and n values.

  • q.rel.conn.multiple: Estimates quantiles for the probability distribution function for relative connectivity between a pair of sites for multiple possible p, k and n values.

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

# p values have uniform probability between 0.1 and 0.4
p <- seq(0.1,0.8,length.out=100)

# Weights the same for all except first and last, which are halved
w <- rep(1,length(p))
w[1]<-0.5
w[length(w)]<-0.5

n <- 20 # Sample size
k <- 2 # Marked individuals in sample

# phi values to use for plotting distribution
phi <- seq(0,1,0.01)

prior.shape1 = 1 # Uniform prior
# prior.shape1 = 0.5 # Jeffreys prior

# Plot distribution
plot(phi,d.rel.conn.multiple(phi,p,k,n,w,prior.shape1=prior.shape1),
     main="Probability density for relative connectivity",
     xlab=expression(phi),
     ylab="Probability density",
     type="l")

# Add standard distributions for max and min p values
lines(phi,d.rel.conn.beta.prior(phi,min(p),k,n,prior.shape1=prior.shape1),
      col="red",lty="dashed")
lines(phi,d.rel.conn.beta.prior(phi,max(p),k,n,prior.shape1=prior.shape1),
      col="red",lty="dashed")

# Add some quantiles
q = q.rel.conn.multiple(c(0.025,0.25,0.5,0.75,0.975),
                        p,k,n,w,prior.shape1=prior.shape1)
abline(v=q,col="green")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.