ReCAP_sampler | R Documentation |
Main sampler of the posterior distribution of vital rates and harvest count in ReCAP
.
ReCAP_sampler(Harv.data, Aerial.data , nage, mean.f, mean.s , mean.SRB, mean.H , mean.A, mean.b = Harv.data[, 1] , n.iter = 50000, burn.in = 5000, thin.by = 10 , al.f = 1, be.f = 0.05, al.s = 1, be.s = 0.1 , al.SRB = 1, be.SRB = 0.05 , min.aK0 = list(matrix(-0.001, nage[1], 1), matrix(-0.001, sum(nage), 1), 0) , max.aK0 = list(matrix(0.001, nage[1], 1), matrix(0.001, sum(nage), 1), 500) , al.H = 1, be.H = 0.05, al.A = 1, be.A = 0.05 , Assumptions = list() , start.sigmasq.f = 0.05, start.sigmasq.s = 0.05 , start.sigmasq.SRB = 0.05, start.sigmasq.H = 0.05 , start.sigmasq.A = 0.05 , prop.vars = list() , proj.periods = (ncol(Harv.data) - 1), estFec = T , estaK0 = F , aK0 = list(matrix(0, nage[1], 1), matrix(0, sum(nage), 1), matrix(0, 1, 1)) , global = T, null = T, point.est = mean, verb = FALSE, s.tol = 10^(-10))
Harv.data |
Harvest data, rows to be age classes and columns for years. |
Aerial.data |
Aerial count data, should be only one row and same number of columns with harvest. |
nage |
Number of age classes, female first. |
mean.f,mean.s |
Best estimation of fecundity/survival. Number of rows and columns should be less than harvest, after multiply by Assumptions matrices (see
|
mean.SRB |
Similar to mean.f, sex ratio at birth, but note SRB is assumed having no age structure. Thus a full SRB matrix should only have one row. |
mean.H |
Similar to fecundity, for harvest rate. Difference is since we assume a pre-repoduction harvest, a full harvest rate matrix should have same size of harvest data. |
mean.A |
Similar to H, Aerial count detection rate. By default, a full aerial count matrix should have same size as aerial count data. |
mean.b |
Best estimation of baseline harvest, usually just firest year's harvest count. |
n.iter |
Number of posterior sample saved. |
burn.in |
Burn in iteration. |
thin.by |
Sample thined by? |
al.f,al.s,al.SRB,al.H,al.A |
Hyperparameter for prior distribution of fecundity/survival/SRB/Harvest rate/Aerial Detection Rate's variance. Variance of vital rates v beside aK0 follow inverse Gamma distribution with parameter al.v and be.v, v can be fecundity, survival, harvest rate, aerial count detection rate and SRB. |
be.f,be.s,be.SRB,be.H,be.A |
Hyperparameter for prior distribution of fecundity/survival/SRB/Harvest rate/Aerial Detection Rate's variance. Variance of vital rates v beside aK0 follow inverse Gamma distribution with parameter al.v and be.v, v can be fecundity, survival, harvest rate, aerial count detection rate and SRB. |
min.aK0,max.aK0 |
Prior distribution of aK0s. If fit density dependent Leslie matrix model:
aK0's component were assumed to be uniformly distributed with parameter min.aK0 and max.aK0. |
Assumptions |
Should be a list, each element is a list and named Fec, Surv, SRB, Harv, AerialDet, aK0 for fecundity, Survival, SRB, Harvest rate, Aerial count detection rate, and linear coeffient of Density Dependency. In each list, there should be two matrices, naming
By default, all Assumptions are identity matrices, i.e. prior mean vital rates matrices should be a full one by itself. |
start.sigmasq.f |
Starting value of fecundity's variance. |
start.sigmasq.s |
Starting value of survival's variance. |
start.sigmasq.SRB |
Starting value of SRB's variance. |
start.sigmasq.H |
Starting value of harvest rate's variance. |
start.sigmasq.A |
Starting value of aerial count detection rate's variance. |
prop.vars |
Proposal variance, should be a list named fert.rate, surv.prop, SRB, A,H, aK0, and baseline.pop.count, same dimension with mean.f, mean.s, mean.SRB, mean.A, mean.H, min.aK0, mean.b. |
proj.periods |
How many years need to be projected? Usually ncol(Harv.data)-1 |
estFec |
Estimate fecundity? Bool. If not, mean.f will be used. |
estaK0 |
Estimate density dependency parameters? Bool. Note this will be masked if set null=TRUE. |
aK0 |
If not estimate aK0, what aK0 is. |
global |
Whether aK0[[3]] is global or age specific (i.e. will there be age specific carrying capcacity). Bool. |
null |
Null model for density dependency? Bool. If null=TRUE, no density dependency will be considered, but model can fit time inhomogeneous vital rates. |
point.est |
How to do point estimation? Can be mean or median. |
verb |
Want a verbose run? Bool |
s.tol |
Tolerant for lowest survival rate (below will be considered as 0). |
Do not use Assumptions unless you understand it.
A list with length 7:
mcmc.objs |
A list of mcmc objects returned by the sampling algorithm |
log.like.mcmc |
mcmc object for log likelihood |
alg.stats |
algorithm statistics, e.g. acceptance rate |
model.checking |
Model checking, including DIC, absolute difference calculated at point estimation and standard deviation of fitted values |
fixed.params |
fixed parameters |
start.vals |
starting value of the algorithm |
alg.params |
parameters for algorithm setting |
Yunyi Shen
##Use our Chicago Deer data. set.seed(42) ReCAP_sampler(ChicagoDeerdata$Harv.data,ChicagoDeerdata$Aeri.data ,ChicagoDeerdata$nage,ChicagoDeerdata$mean.f,ChicagoDeerdata$mean.s ,ChicagoDeerdata$mean.SRB,ChicagoDeerdata$mean.H,ChicagoDeerdata$mean.A ,n.iter = 50,burn.in = 50,thin.by = 1 ,Assumptions = ChicagoDeerdata$Assumptions) ## another example ### This makes a full prior harvest matrix and the model will run a fully age ### and time specific reconstruction of harvest rate together with other vital rates. mean.H.full <- ChicagoDeerdata$Assumptions$Harv$age %*% as.matrix( ChicagoDeerdata$mean.H) %*% ChicagoDeerdata$Assumptions$Harv$time set.seed(42) ReCAP_sampler(ChicagoDeerdata$Harv.data,ChicagoDeerdata$Aeri.data ,ChicagoDeerdata$nage,ChicagoDeerdata$mean.f,ChicagoDeerdata$mean.s ,ChicagoDeerdata$mean.SRB,mean.H.full,ChicagoDeerdata$mean.A ,n.iter = 50,burn.in = 50,thin.by = 1 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.