dmm: Drifting Markov model specification

View source: R/dmm.R

dmmR Documentation

Drifting Markov model specification

Description

Creates a drifting Markov model object dmm from parameters given by the user.

Usage

dmm(states, init, matrices, order, degree = length(matrices) - 1, length)

Arguments

states

Vector of states space of length s > 1

init

Initial law of the k first states: a numeric vector of length s^k (named or in the alphabetical order of the words of length k), or "unif" for the uniform law, or "stationary" for the stationary law of \Pi_{\frac{k-1}{n}}.

matrices

A list of degree+1 transition matrices of dimension (s^k, s) (the points of support \Pi_0, \ldots, \Pi_1)

order

Order of the Markov chain

degree

Default=length(matrices) - 1. Degree of the polynomials (e.g., linear drifting if degree=1, etc.)

length

Length n of the drifting Markov chain (the sequence is X_0, \ldots, X_n)

Details

This function creates a drifting Markov model object dmm without estimation, starting from the points of support transition matrices and the initial law specified by the user. The resulting object has the same structure as the one returned by fitdmm, so that it can be used with all the functions of the package (e.g., simulate.dmm, getTransitionMatrix, reliability, etc.).

A polynomial drifting Markov chain of order k, degree d and length n is defined by d+1 Markov transition matrices (of order k) \Pi_{\frac{i}{d}}, i = 0, \ldots, d, called points of support. The transition matrix at position t, t = 1, \ldots, n, is \Pi_{\frac{t}{n}} = \sum_{i=0}^d A_i(t) \Pi_{\frac{i}{d}}, where A_i are the Lagrange polynomials of degree d such that A_i(\frac{nj}{d}) = 1_{\{i=j\}}. For a linear drifting Markov chain (d = 1), we have \Pi_{\frac{t}{n}} = ( 1 - \frac{t}{n}) \Pi_0 + \frac{t}{n} \Pi_1.

Each matrix of 'matrices' has s^k rows (one for each word of length k) and s columns (one for each state). If the matrices have no row names, the rows are taken in the alphabetical order of the words of length k (as in fitdmm); otherwise the rows are reordered according to their names. The columns are in the order of 'states' (or reordered according to their names). In the returned object, the states are sorted in alphabetical order, as in fitdmm.

Value

An object of class dmm

Author(s)

Georges Sadaka

References

\insertRef

BaVe2018drimmR \insertRefVer08drimmR

See Also

fitdmm, simulate.dmm, getTransitionMatrix

Examples

states <- c("a", "c", "g", "t")

# Points of support transition matrices
Pi0 <- matrix(c(0.25, 0.25, 0.25, 0.25,
                0.10, 0.40, 0.40, 0.10,
                0.30, 0.20, 0.20, 0.30,
                0.40, 0.10, 0.10, 0.40),
              nrow = 4, byrow = TRUE)
Pi1 <- matrix(c(0.70, 0.10, 0.10, 0.10,
                0.10, 0.70, 0.10, 0.10,
                0.10, 0.10, 0.70, 0.10,
                0.10, 0.10, 0.10, 0.70),
              nrow = 4, byrow = TRUE)

model <- dmm(states = states, init = c(0.25, 0.25, 0.25, 0.25),
             matrices = list(Pi0, Pi1), order = 1, degree = 1, length = 1000)
getTransitionMatrix(model, pos = 500)

drimmR documentation built on Nov. 28, 2026, 1:08 a.m.