calc_markov_post_param: Conditional posterior distribution of Markov chain.

Description Usage Arguments Value See Also Examples

Description

calc_markov_post_param returns the conditional posterior distribution of the behaviour parameters (given prior and observation of the chain).

Usage

1
calc_markov_post_param(prior_param, num_states, suff_stat)

Arguments

prior_param

List with components:

lambda_rate

Vector (length num_states) with prior rate of the switching rates.

lambda_shape

Vector (length num_states) with prior shape of the switching rates.

q_conc

Matrix (square, size num_states with NA diagonal elements) with prior concentration of the switching probabilities.

num_states

Numeric, number of behavioural states.

suff_stat

List with components:

time_in_state

Vector (length num_states) with total time spent in each behavioural state.

num_trans

Matrix (square, size num_states with NA diagonal elements) with number of transitions from each state (row) to every other (column).

Value

List with the components:

lambda_rate

Vector (length num_states) with posterior rate of the switching rates.

lambda_shape

Vector (length num_states) with posterior shape of the switching rates.

q_conc

Matrix (square, size num_states with NA diagonal elements) with posterior concentration of the switching probabilities.

See Also

Other Behaviour parameters: calc_markov_suff_stats, check_valid_markov, update_behav_param

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
33
34
35
36
prior <- list(lambda_rate = c(0.1, 0.2),
              lambda_shape = c(2, 1),
              q_conc = matrix(c(NA, 1, 1, NA), nrow = 2))
suff <- list(time_in_state = c(34, 16),
             num_trans = matrix(c(NA, 2, 3, NA), nrow = 2))

calc_markov_post_param(prior, 2, suff)
# $lambda_shape
# [1] 5 3
#
# $lambda_rate
# [1] 34.1 16.2
#
# $q_conc
# [,1] [,2]
# [1,]   NA    1
# [2,]    1   NA

prior <- list(lambda_rate = c(0.1, 0.2, 0.3),
              lambda_shape = c(4, 3, 2),
              q_conc = matrix(c(NA, 0.5, 0.3, 0.2, NA, 0.7, 0.8, 0.5, NA), nrow = 3))
suff <- list(time_in_state = c(87, 114, 99),
             num_trans = matrix(c(NA, 1, 1, 2, NA, 2, 1, 2, NA), nrow = 3))

calc_markov_post_param(prior, 3, suff)
# $lambda_shape
# [1] 7 6 5
#
# $lambda_rate
# [1]  87.1 114.2  99.3
#
# $q_conc
# [,1] [,2] [,3]
# [1,]   NA  2.2  1.8
# [2,]  1.5   NA  2.5
# [3,]  1.3  2.7   NA

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