dsdive.obstx.matrix_interpolator: Interpolators for probability transition matrices of...

Description Usage Arguments Examples

View source: R/dsdive.obstx.matrix_interpolator.R

Description

Given a range of model parameters, this function will compute the probability transition matrices for all combinations of a Continuous time Markov chain (CTMC) that is observed once, and then again at a time of tstep units of time later. Then, thin plate spline interpolating functions will be built to allow probability transition matrix entries to be approximated at different values of the input parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dsdive.obstx.matrix_interpolator(
  depth.bins,
  beta.seq,
  lambda.seq,
  s0,
  tstep.seq,
  m,
  verbose = FALSE,
  cl = NULL
)

Arguments

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.seq

the range of depth bin transition model parameters

lambda.seq

the range of depth bin transition rate model parameters

s0

the stage for which to compute the transition matrix

tstep.seq

Range of times between observations of the CTMC

m

Smoothing polynomial degree; this is the m argument in the smoothing function, fields::Tps.

verbose

TRUE to output progress of code

cl

cluster over which computations can be parallelized

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)

# support for descent directional preferences
beta.seq = seq(.5, 1, length.out = 7)
beta.seq[length(beta.seq)] = .999

# support for descent speeds
lambda.seq = seq(.1, 2, length.out = 7)

# support for timesteps
tstep.seq = seq(0, 300, by = 100)

# build interpolating function
interpolator = dsdive.obstx.matrix_interpolator(
  depth.bins = depth.bins, beta.seq = beta.seq, lambda.seq = lambda.seq, 
  s0 = 1, tstep.seq = tstep.seq, m = 3, verbose = TRUE)

interpolator(beta = .8, lambda = 1, tstep = 300, i = 1, j = 4)


# cl = makeCluster(spec = 3, type = 'SOCK')
# clusterEvalQ(cl, library(dsdive))
# 
# interpolator = dsdive.obstx.matrix_interpolator(
#   depth.bins = depth.bins, beta.seq = beta.seq, lambda.seq = lambda.seq, 
#   s0 = 1, tstep.seq = tstep.seq, m = 3, verbose = TRUE, cl = cl)
# 
# stopCluster(cl = cl)

detach(dive.sim)

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