Learn R Programming

LaMa (version 1.0.0)

stateprobs_p: Calculate conditional local state probabilities for periodically inhomogeneous HMMs

Description

Computes

\(\Pr(S_t = j \mid X_1, ..., X_T)\)

Usage

stateprobs_p(delta, Gamma, allprobs, tod)

Value

Matrix of conditional state probabilities of dimension c(n,N)

Arguments

delta

Initial or periodically stationary distribution of length N

Gamma

Array of transition probability matrices of dimension c(N,N,L) where L is the cycle length.

Here we use the definition \(\Pr(S_t=j \mid S_{t-1}=i) = \gamma_{ij}^{(t)}\) such that the transition probabilities between time point \(t-1\) and \(t\) are an element of \(\Gamma^{(t)}\).

allprobs

Matrix of state-dependent probabilities/ density values of dimension c(n, N)

tod

(Integer valued) time variable in 1, ..., L, mapping the data index to a generalized time of day (length n). For half-hourly data L = 48. It could, however, also be day of year for daily data and L = 365.

Examples

Run this code
L = 24
beta = matrix(c(-1, 2, -1, -2, 1, -1), nrow = 2, byrow = TRUE)
Gamma = tpm_p(1:L, L, beta, degree = 1)
delta = stationary_p(Gamma, 1)
allprobs = matrix(runif(200), nrow = 100, ncol = 2)
tod = rep(1:24, 5)[1:100]

probs = stateprobs_p(delta, Gamma, allprobs, tod)

Run the code above in your browser using DataLab