Bayesian.remigration: Return a posterior remigration interval.

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

View source: R/Bayesian.remigration.R

Description

Model of remigration interval

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
Bayesian.remigration(
  parameters = stop("Priors must be supplied"),
  data = stop("data must be supplied"),
  kl = NULL,
  n.iter = 1e+05,
  n.chains = 1,
  n.adapt = 10000,
  thin = 1,
  trace = 10,
  adaptive = TRUE,
  adaptive.lag = 500,
  adaptive.fun = function(x) {     ifelse(x > 0.234, 1.3, 0.7) },
  intermediate = NULL,
  filename = "intermediate.Rdata",
  previous = NULL
)

Arguments

parameters

Priors for Bayesian MCMC

data

Data to be fitted

kl

Maximum number of years for remigration intervals.

n.iter

Number of iterations for MCMC

n.chains

Number of replicates

n.adapt

Number of iterations before to store outputs

thin

Number of iterations between each stored output

trace

Or FALSE or period to show progress

adaptive

Should an adaptive process for SDProp be used

adaptive.lag

Lag to analyze the SDProp value in an adaptive context

adaptive.fun

Function used to change the SDProp

intermediate

Period for saving intermediate result, NULL for no save

filename

If intermediate is not NULL, save intermediate result in this file

previous

Previous result to be continued. Can be the filename in which intermediate results are saved.

Details

Bayesian.remigration fits a remigration interval using Bayesian MCMC

Value

Return a posterior remigration interval.

Author(s)

Marc Girondot

See Also

Other Model of Remigration Interval: LnRI_norm(), RI(), plot.Remigration()

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
37
38
39
40
41
42
43
## Not run: 
library(phenology)
# Example

# Each year a fraction of 0.9 is surviving
s <- c(s=0.9)
# Probability of tag retention; 0.8
t <- c(t=0.8)
# Time-conditional return probability - This is the true remigration rate
r <- c(r1=0.1, r2=0.8, r3=0.7, r4=0.7, r5=1)
# Capture probability
p <- c(p1=0.6, p2=0.6, p3=0.6, p4=0.6, p5=0.6)
# Number of observations for 400 tagged females after 1, 2, 3, 4, and 5 years
OBS <- c(400, 10, 120, 40, 20, 10)

kl_s <- length(s)
kl_t <- length(t)
kl_r <- length(r)
kl_p <- length(p)

pMCMC <- data.frame(Density=c("newdbeta", "newdbeta", rep("dunif", kl_r), 
                              rep("newdbeta", kl_p), "dunif"), 
                    Prior1=c(s, t, rep(0, kl_r), rep(0.2, kl_p), 0), 
                    Prior2=c(0.02, 0.02, rep(1, kl_r), rep(0.08, kl_p), 10), 
                    SDProp=c(0.05, 0.05, rep(0.05, kl_r), rep(0.05, kl_p), 0.05), 
                 Min=c(0, 0, rep(0, kl_r), rep(0, kl_p), 0),  
                 Max=c(1, 1, rep(1, kl_r), rep(1, kl_p), 10),  
                 Init=c(s, t, r, p, 1), stringsAsFactors = FALSE, 
                 row.names=c("s", 
                                "t", 
                                names(r), 
                                names(p), "sd")
)
rMCMC <- Bayesian.remigration(parameters = pMCMC, 
n.iter = 1000000, 
n.adapt = 300000,
trace=10000, 
data=OBS)

plot(rMCMC)


## End(Not run)

phenology documentation built on Oct. 23, 2020, 7:22 p.m.