DerivedValues: Function to post-process MCMC results of the year-specific...

Description Usage Arguments Value Author(s) Examples

View source: R/DerivedValues.R

Description

This function derives realized and expected population growth rates and population sizes from the inputted MCMC chains.

Usage

1
DerivedValues(N, gamma, phi, psi, M, extrap = 0)

Arguments

N

matrix containing the posteriors for abundance

gamma

matrix or vector containing the posteriors for gamma(s)

phi

matrix or vector containing the posteriors for phi(s)

psi

vector containing the posterior for psi

M

an integer indicating the i dimension of the augmented data

extrap

an optional integer indicating how many primary periods to extrapolate beyond the observed primary periods for EN. These are abundance projections from the population growth model

Value

a list containing realized and expected population growth rates and population sizes,

Author(s)

Ben Augustine

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
## Not run: 
#Run a model
t=3
N=50
p0=0.5
lam0=-log(1-p0)
sigma=0.750
phi=0.7
gamma=0.3
buff=3
X=list(expand.grid(4:9,4:9),expand.grid(4:9,4:9),expand.grid(4:9,4:9)) #Note we need 3 trap objects stuffed into the trap list
K=c(10,10,10) #and 3 numbers of occasions within primary period
M=225
data=simOpenSCR(N=N,phi=phi,gamma=gamma,lam0=lam0,sigma=sigma,K=K,X=X,t=t,M=M,buff=buff,obstype="bernoulli")
inits=list(lam0=lam0,sigma=sigma,gamma=gamma,phi=phi,psi=N[1]/M)
niter=1000
nburn=0
nthin=1
proppars=list(lam0=0.025,sigma=0.025,gamma=0.1,phi=0.1,s1x=0.2,s1y=0.2,propz=c(30,30)) #Need 1 more propz
out=mcmc.OpenSCR(data,niter=niter,nburn=nburn, nthin=nthin, M =M, inits=inits,proppars=proppars,Rcpp=TRUE)
DV=DerivedValues(out$out[,5:7],out$out[,3],out$out[,4],out$out[,8],M)
str(DV)
library(coda)
plot(mcmc(DV$EN))
plot(mcmc(DV$lambda))
plot(mcmc(DV$Elambda))
#should discard burnin

## End(Not run)

benaug/OpenPopSCR documentation built on Feb. 3, 2022, 10:04 a.m.