Learn R Programming

rEMM (version 0.1-2)

predict: Predict a Future State

Description

Predict a state or the probability distribution over states in $n$ time steps.

Usage

## S3 method for class 'EMMLayer':
predict(object, n = 1, current_state = NULL, 
	probabilities = FALSE)

Arguments

object
an "EMM"/"EMMLayer" object.
n
number of time steps.
current_state
use a specified current state. If NULL, the EMM's current state is used.
probabilities
if TRUE, instead of the predicted state, the probability distribution is returned.

Value

  • The name of the predicted state or a vector with the probability distribution over all states.

Details

Prediction is done using $A^n$ where $A$ is the transition probability matrix maintained by the EMM. Random tie-breaking is used.

See Also

transition_matrix

Examples

Run this code
data("EMMTraffic")
emm <- EMM(measure="eJaccard", threshold=0.2)
emm <- build(emm, EMMTraffic)

#plot(emm) ## plot graph

## Predict state starting an state 1 after 1, 2 and 100 time intervals
## Note, state 7 is an absorbing state.
predict(emm, n=1, current_state="1")
predict(emm, n=2, current_state="1")
predict(emm, n=100, current_state="1")

## Get probability distribution
predict(emm, n=2, current_state="1", probabilities = TRUE)

Run the code above in your browser using DataLab