dsdive.obs.sampleparams: Sample pi and lambda parameters for a single dive stage

Description Usage Arguments Examples

View source: R/dsdive.obs.sampleparams.R

Description

Sampler uses a Gaussian approximation to the full conditional posterior.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
dsdive.obs.sampleparams(
  dsobs.list,
  t.stages.list,
  P.raw,
  s0,
  depth.bins,
  beta,
  lambda,
  lambda.priors.list,
  beta.priors.list,
  tstep,
  gapprox = NULL,
  output.gapprox = FALSE,
  delta
)

Arguments

dsobs.list

list of dsobs objects, which describe the observation times and depths of a collection of dives

t.stages.list

list of initial stage transition times for dives observed in dsobs.list

P.raw

list of continuous time probability transition matrices, and components.

s0

stage for which model parameters should be sampled

depth.bins

n x 2 Matrix that defines the depth bins. The first column defines the depth at the center of each depth bin, and the second column defines the half-width of each bin.

beta

directional preference model parameters. See dsdive.tx.params for more details.

lambda

diving rate model parameters. See dsdive.tx.params for more details.

lambda.priors.list

list of parameters for the prior distributions for the diving rate parameters. See dsdive.gibbs.obs for more information.

beta.priors.list

list of parameters for the prior distributions for the directional preference parameters. See dsdive.gibbs.obs for more information. Note that these priors are specified as "pi" priors vs. priors for "beta".

tstep

Time between observations in dsobs.unaligned

gapprox

(Optional) gaussapprox object containing the Gaussian approximation used to propose model parameters. If NULL, then a Gaussian approximation will be computed.

output.gapprox

TRUE to return the Gaussian approximation used to propose model parameters.

delta

If delta>0, then the probability transition matrices computed will use a transition matrix whose generator is perturbed to allow much faster computation. See dsdive.obstx.matrix for more details.

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
data('dive.sim')
attach(dive.sim)
attach(dive.sim$params)

t.stages = sim$times[c(FALSE,diff(sim$stages)==1)]
  
tstep = diff(sim.obs$times[1:2])

obstx.mat = lapply(1:3, function(s) {
  dsdive.obstx.matrix(depth.bins = depth.bins, beta = beta, 
                      lambda = lambda, s0 = s, tstep = tstep, 
                      include.raw = TRUE, delta = 1e-10)
})

lambda.priors = list(
  c(4, 2 + 2/3), c(4, 13 + 1/3), c(4, 5)
)

beta.priors = list(
  c(31.5, 3.5), c(3.5, 31.5)
)

x = dsdive.obs.sampleparams(dsobs.list = list(sim.obs), 
                            t.stages.list = list(t.stages), P.raw = obstx.mat, 
                            s0 = 1, depth.bins = depth.bins, beta = beta, 
                            lambda = lambda, lambda.priors.list = lambda.priors, 
                            beta.priors.list = beta.priors, 
                            tstep = diff(sim.obs$times[1:2]), delta = 1e-10)

detach(dive.sim$params)
detach(dive.sim)

jmhewitt/dsdive documentation built on May 29, 2020, 5:18 p.m.