Description Usage Arguments Value Author(s) Examples
View source: R/DerivedValuesSex.R
This function derives realized and expected population growth rates, population sizes, and sex ratios from the inputted MCMC chains.
1 | DerivedValuesSex(Nm, Nf, gamma, phi, psex, psi, M, extrap = 0)
|
Nm |
matrix containing the posteriors for the number of males |
Nf |
matrix containing the posteriors for the number of females |
gamma |
matrix or vector (if sex-specific) containing the posteriors for gamma(s) |
phi |
matrix or vector (if sex-specific) containing the posteriors for phi(s) |
psex |
vector containing the posterior for psex |
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, ENm, and ENf. These are abundance projections from the population growth model |
a list containing realized and expected population growth rates, population sizes, and sex ratios
Ben Augustine
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 | ## Not run:
#Run a sex-specific model
t=3
N=c(40,40)
p0=c(0.25,0.5)
lam0=-log(1-p0)
sigma=c(0.75,0.5)
phi=c(0.4,0.8)
gamma=c(0.4,0.1)
buff=3
X=list(expand.grid(4:9,4:9),expand.grid(4:9,4:9),expand.grid(4:9,4:9))
K=c(10,10,10)
M=250
pIDsex=0.75
obstype="bernoulli"
ACtype="metamu"
data=simOpenSCRsex(N=N,gamma=gamma,phi=phi,lam0=lam0,sigma=sigma,K=K,X=X,t=t,M=M,buff=buff,
ACtype=ACtype,obstype="bernoulli",pIDsex=pIDsex,sigma_t=sigma_t)
inits=list(lam0=lam0,sigma=sigma,gamma=gamma,phi=phi,psi=(sum(N)/M),psex=0.5)
niter=1000
nburn=0
nthin=1
proppars=list(lam0=c(0.075,0.115),sigma=c(0.055,0.045),gamma=c(0.115,0.085),s1x=0.4,s1y=0.4,
sigma_t=c(0.04,0.03),sex=100)
out=mcmc.OpenSCR.sex(data,niter=niter,nburn=nburn, nthin=nthin, M=M, inits=inits,proppars=proppars,
ACtype=ACtype)
DV=DerivedValuesSex(out$out[,12:14],out$out[,15:17],out$out[,5:6],out$out[,7:8],out$out[,18],out$out[,19],M)
str(DV)
library(coda)
plot(mcmc(DV$lambdaM))
plot(mcmc(DV$lambdaF))
#etc.
#should discard burnin
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.