stationary: Stationary state probabilities

stationaryR Documentation

Stationary state probabilities

Description

Calculates the stationary probabilities of each state based on covariate values.

Usage

stationary(model, covs, covIndex)

Arguments

model

momentuHMM, miHMM, or miSum object

covs

Either a data frame or a design matrix of covariates. If covs is not provided, then the stationary probabilties are calculated based on the covariate data for each time step.

covIndex

Integer vector indicating specific rows of the data to be used in the calculations. This can be useful for reducing unnecessarily long computation times, e.g., when formula includes factor covariates (such as ID) but no temporal covariates. Ignored unless covs is missing.

Value

A list of length model$conditions$mixtures where each element is a matrix of stationary state probabilities for each mixture. For each matrix, each row corresponds to a row of covs, and each column corresponds to a state.

Examples

# m is a momentuHMM object (as returned by fitHMM), automatically loaded with the package
m <- example$m

# data frame of covariates
stationary(m, covs = data.frame(cov1 = 0, cov2 = 0))

# design matrix (each column corresponds to row of m$mle$beta)
stationary(m, covs = matrix(c(1,0,cos(0)),1,3))

# get stationary distribution for first 3 observations
stationary(m, covIndex = c(1,2,3))


bmcclintock/momentuHMM documentation built on Oct. 26, 2022, 1 a.m.