Learn R Programming

LSC (version 0.1.5)

states2probs: Convert states to vector of probabilities of any given state

Description

Converts states (either as a size $N$ array of labels or an $N \times K$ weight matrix) into $N$ probabilities per state.

If states is a matrix - representing the state space in the dimensions of the original data - then the probabilities will be formatted automatically to an array of the same shape and dimension.

Usage

states2probs(weight.matrix = NULL, states = NULL, type = "MLE")

Arguments

states
array of size $N$ with entry $i$ being the label $k = 1, \ldots, K$ of PLC $i$
weight.matrix
$N \times K$ weight matrix
type
estimation type for the probabilities: c("MLE")

See Also

weight_matrix2states

Examples

Run this code
state.sim <- sample.int(5, 100, replace = TRUE)
prob.state <- states2probs(states = state.sim)
layout(matrix(1:2, ncol = 2))
plot(state.sim, xlab = "", ylab = "state")
plot(prob.state, xlab = "", ylab = "probability")
plot(state.sim, prob.state, xlab = "state", ylab = "probability", type = "h")

Run the code above in your browser using DataLab