Description Usage Arguments Details Value Author(s) See Also Examples
Access to model parameters and densities of emission distributions.
1 2 3 4 |
x |
Object of class |
i |
State for which parameter values should be retrieved. This can either a numeric value giving the state index or a character string with the state name. |
j |
Second index identifying parameter (see Details). |
transition |
Logical indicating whether transition probabilities or density values should be returned. |
log |
Logical indicating whether values should be log transformed before they are returned. |
sum |
Logical indicating whether densities of mixture components should be summed up.
This is ignored if |
... |
Futher arguments to be passed to and from other methods. |
The ‘[’ function allows access to the transition probability matrix of the model as well as the emission
distributions. If transition = TRUE
the transition probability matrix is accessed. In this case
i
and j
identify rows and columns of the matrix respectively. Both can be given as either
numeric index or name of the respective states. Either or both of i
and j
may be missing
to indicate that an entire row or column should be selected.
If transition = FALSE
the emission distribution of state i
is accessed instead. In this case
the density function is evaluated at point j
.
For ‘[’ either a subset of the transition probability matrix of x
or the probability density of state i
evaluated at point j
(see Details).
For ‘length’ the number of states in the model.
Peter Humburg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## create two state HMM with t distributions
state.names <- c("one","two")
transition <- c(0.1, 0.02)
location <- c(1, 2)
scale <- c(1, 1)
df <- c(4, 6)
hmm <- getHMM(list(a=transition, mu=location, sigma=scale, nu=df),
state.names)
## number of states in the model
length(hmm)
## transition probability from state 'one' to state 'two'
hmm["one", "two"]
## or equivalently
hmm[1, 2]
## get the transition probability matrix
hmm[ , ]
## evaluate emission distribution function of state 'one' at 0
hmm["one", 0, transition = FALSE]
## again, this time using log transformation
hmm["one", 0, transition = FALSE, log = TRUE]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.