Description Usage Arguments Details Value See Also Examples

Inference on the hidden states for given observations and model specifications of a hidden semi-Markov model. For every observation, the function calculates the probability of being in a particular state.

1 2 3 4 5 6 7 8 | ```
hsmm.smooth(x,
od,
rd,
pi.par,
tpm.par,
od.par,
rd.par,
M = NA)
``` |

` x` |
The observations as a vector of length |

` od` |
Character containing the name of the conditional distribution of the observations. For details see |

` rd` |
Character containing the name of the runlength distribution (or sojourn time, dwell time distribution). For details see |

` pi.par` |
Vector of length |

` tpm.par` |
Matrix of dimension |

` rd.par` |
List with the values for the parameters of the runlength distributions. For details see |

` od.par` |
List with the values for the parameters of the conditional observation distributions. For details see |

` M` |
Positive integer containing the maximum runlength. |

The function `hsmm.smooth`

calculates the so-called smoothed probabilities

*
P(S[t] = i | X[1], ... , X[T])*

for all *t in 1, ... , T* and *i in 1,...,J*, with *X* denoting the observations and
*S* the hidden states. This procedure is often termed 'local decoding'.
The sequence of the most probable states follows directly.
Note that this sequence is not necessarily the most probable state sequence, which is determined by the Viterbi algorithm.
Also note that local decoding may ignore restrictions imposed by the transition probability matrix, such as forbidden transitions,
because it optimizes locally for every single observation.

`call` |
The matched call. |

`smooth.prob` |
A matrix of dimension |

`path` |
A vector of length |

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 | ```
# Simulating observations:
# (see hsmm.sim for details)
pipar <- rep(1/3, 3)
tpmpar <- matrix(c(0, 0.5, 0.5,
0.7, 0, 0.3,
0.8, 0.2, 0), 3, byrow = TRUE)
rdpar <- list(p = c(0.98, 0.98, 0.99))
odpar <- list(mean = c(-1.5, 0, 1.5), var = c(0.5, 0.6, 0.8))
sim <- hsmm.sim(n = 2000, od = "norm", rd = "log",
pi.par = pipar, tpm.par = tpmpar,
rd.par = rdpar, od.par = odpar, seed = 3539)
# Computation of the smoothing probabilities:
fit.sm <- hsmm.smooth(sim$obs, od = "norm", rd = "log",
pi.par = pipar, tpm.par = tpmpar,
od.par = odpar, rd.par = rdpar)
# The first 15 smoothing probabilities:
round(fit.sm$sm[, 1:15], 2)
# The first 15 values of the resulting path:
fit.sm$path[1:15]
# For comparison, the real/simulated path (first 15 values):
sim$path[1:15]
``` |

hsmm documentation built on May 30, 2017, 3:31 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.