This function assigns the hidden states at each time step t to the hidden state k with largest estimated filtered probability (alpha).

classify_alpha(fit, reduce = mean, chain = "all")

Arguments

fit

An object returned by either draw_samples or optimizing.

reduce

An optional function applied to the samples corresponding to one time step t, one hidden state k, and one chain m. The observation at time step t is then assigned to the hidden state with largest value. Note that the user needs to supply a function as an argument, and not a character string with the name of the function. This argument is not used for maximum a posteriori estimates returned by optimizing since there is only one scalar per quantity. It defaults to the mean function.

chain

Either "all" or any integer number between 1 and the number of chains M. In the latter case, only the samples generated by the selected chain are considered. This argument is not used for maximum a posteriori estimates returned by optimizing since there is only one result. It defaults to "all".

Value

A numeric vector with size equal to the time series length T with values from 1 to the number of hidden states K.