calc_step_lik: Step likelihood.

Description Usage Arguments Value See Also Examples

Description

calc_step_lik returns the likelihood of a set of steps given speed parameters.

Usage

1
calc_step_lik(fixed_constant, refined_path, move_params, behav_params)

Arguments

fixed_constant

List with components:

num_states

Numeric, number of behavioural states.

indep_step

Boolean, True if model is independent step, False if it is correlated step.

q.speed_mean

Vector, index positions within move_params relating to speed mean parameters.

q.speed_corr

Vector, index positions within move_params relating to speed correlation parameters.

q.speed_var

Vector, index positions within move_params relating to speed variance parameters.

refined_path

List with components:

time_diffs

Vector, differences in the refined time scale.

behavs

Vector, refined behavioural/state sequence.

steps

Vector, refined step process.

move_params

Vector of movement parameters (as turn_var_1, turn_var_2, mean_speed_1, .., speed_var_2).

behav_params

List with components:

lambda

Vector (length num_states) of switching rates.

q

Matrix (square size num_states with NA diagonal elements) of switching probabilities. Note: row = from, column = to.

Value

Numeric, likelihood of the set of steps.

See Also

Other Speed parameters: calc_cond_step_dist, calc_markov_steady_state, update_speed_param

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
const <- list(num_states = 3,
              indep_step = FALSE,
              q.speed_mean = 4:6,
              q.speed_corr = 7:9,
              q.speed_var = 10:12)
path <- list(steps = c(5.3, 6.8, 15.3, 14.5, 9.4, 3.4, 8.5, 14.6, 17.8, 22.4, 16.7),
             time_diffs = c(1, 1, 1.5, 1.5, 1, 0.5, 1, 1, 1, 2, 1),
             behavs = c(1, 1, 1, 2, 2, 3, 3, 2, 2, 2, 1))
move_params <- c(NA, NA, NA, 5, 10, 3, 0.1, 0.2, 0.3, 4, 6, 2)
behav_params <- list(lambda = c(0.1, 0.2, 0.3),
                     q = matrix(c(NA, 0.5, 0.2, 0.3, NA, 0.8, 0.7, 0.5, NA), nrow = 3))

calc_step_lik(const, path, move_params, behav_params)
# [1] -78.24704

path <- list(steps = c(5.3, 6.8, 15.3, 14.5, 9.4, 3.4, 8.5, 14.6, 17.8, 22.4, 16.7),
             time_diffs = c(2, 2, 0.5, 1, 2, 0.25, 2, 1.5, 1, 1.2, 0.6),
             behavs = c(1, 1, 1, 2, 2, 3, 3, 2, 2, 2, 1))
calc_step_lik(const, path, move_params, behav_params)
# [1] -791.1856

a-parton/CTStepTurn documentation built on May 14, 2019, 4:17 p.m.