ldhmm.gamma_init: Initializing tansition probability paramter

Description Usage Arguments Value Author(s) Examples

View source: R/ldhmm-gamma_init.R

Description

This utility has multiple purposes. It can generate a simple transition probability matrix, using p1 and p2, if prob is left as NULL. The generated gamma is raw and not normalized. If prob is provided as a vector, the utility converts it into a matrix as gamma. Furthermore, if prob is provided as a vector or matrix, the utility applies min.gamma, and normalize the sum of t.p.m. rows to 1. This is mainly an internal function used by MLE, not be concerned by external users.

Usage

1
ldhmm.gamma_init(m, p1 = 0.04, p2 = 0.01, prob = NULL, min.gamma = 0)

Arguments

m

numeric, number of states

p1

numeric, the first-neighbor transition probability, default is 0.4.

p2

numeric, the second-neighbor transition probability, default is 0.1.

prob

numeric or matrix, a full specified transition probability by user, default is NULL. If this is specified, p1, p2 would be ignored.

min.gamma

numeric, a minimum transition probability added to gamma to avoid singularity, default is 0. This is only used when prob is not NULL.

Value

a matrix as gamma

Author(s)

Stephen H. Lihn

Examples

1
2
3
4
5
6
  gamma0 <- ldhmm.gamma_init(m=3)
  prob=c(0.9, 0.1, 0.1, 
         0.1, 0.9, 0.0,
         0.1, 0.1, 0.8)
  gamma1 <- ldhmm.gamma_init(m=3, prob=prob)
  gamma2 <- ldhmm.gamma_init(m=2, prob=gamma1, min.gamma=1e-6)

ldhmm documentation built on March 18, 2018, 1:51 p.m.