update.eoar: update.eoar - Update method for EoAR objects

Description Usage Arguments Value Author(s) See Also Examples

View source: R/update.eoa.r

Description

Update (run more iterations of) an EoAR model object output by eoar().

Usage

1
2
## S3 method for class 'eoar'
update(obj, niters, nburns = 0, nthins = 1, add = FALSE, quiet = FALSE)

Arguments

obj

An object of class eoar. See function eoar.

niters

Number of additional iterations to do.

nburns

Number of additional iterations to burn.

nthins

Thinning interval for additional iterations

add

If TRUE, the additional niters/nthin kept iterations will be appended to the previous iterations. If FALSE, the additional niters/nthin kept iterations will overwrite the previous iterations, effectively increasing the burn-in period of the MCMC model.

Value

An eoar model object. See eoar

Author(s)

Trent McDonald

See Also

eoar, coef.eoar.

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
# A 3 year study of 7 sites. 21 "cells". lambda change = 20/year
set.seed(9430834) # fixes Y and g of this example, but not the RNG's used in chains
ns <- 3

ny <- 7
g <- data.frame(
 alpha = rnorm(ns*ny,70,2),
 beta = rnorm(ns*ny,700,25)
)
Y <- rbinom(ns*ny, c(rep(20,ny), rep(40,ny), rep(60,ny)), g$alpha/(g$alpha+g$beta))

df <- data.frame(year=factor(c(rep("2015",ny),rep("2016",ny),rep("2017",ny))),
   Year=c(rep(1,ny),rep(2,ny),rep(3,ny)))

# Uninformed eoar (use low number of iterations because it's and example)
eoa.1 <- eoar(Y~year, g, df, nburn = 1000, niters= 50*10, nthins = 10 )

# Could do this if eoa.1 did not converge
#  1) Consider everything in eoa.1 to be burn-in. (nadapt+nburn+niters iterations)
#  2) Burn another 1000 iterations, then sample 1000 taking every 10th
eoa.2 <- update(eoa.1, nburns=1000, niters=1000, nthin=10)

# Could do the following if eoa.1 converged, but autocorrelation was high.
#  1) Consider everything in eoa.1 to be burn-in. (nadapt+nburn+niters iterations)
#  2) Do another 1000 iterations with higher thinning
eoa.2 <- update(eoa.1, nburns=0, niters=1000, nthin=50)

# Could do the following if eoa.1 converged and autocorrelation were low,
# but simulation error was high (i.e., need more iterations)
#  1) Consider the n.iters in eoa.1 "good".
#  2) Add another 1000 iterations with same (or different) thinning
eoa.2 <- update(eoa.1, nburns=0, niters=1000, nthin=50, add=TRUE)

tmcd82070/EoAR documentation built on July 13, 2021, 5:52 p.m.