Description Usage Arguments Details Value Author(s) See Also Examples

Returns the probabilities that the underlying hidden state is equal to each of the possible state values, at each time point, given the observation sequence. Also can return the fitted conditional means, if requested, given that the observations are numeric.

1 |

`y` |
The observations on the basis of which the probabilities
of the underlying hidden states are to be calculated. May be
a sequence of observations, or a list each component of which
constitutes a (replicate) sequence of observations. If |

`object` |
An object of class |

`tpm` |
The transition probability matrix for the underlying hidden
Markov chain. Ignored if |

`Rho` |
The matrix of probabilities specifying the distribution of
the observations, given the underlying state. The rows of this
matrix correspond to the possible values of the observations, the
columns to the states. Ignored if |

`ispd` |
Vector specifying the initial state probability distribution
of the underlying hidden Markov chain.
Ignored if |

`means` |
A logical scalar; if |

Then conditional mean value at time *t* is calculated
as

*SUM_k gamma_t(k)*mu_k*

where *gamma_t(k)* is the conditional
probability (given the observations) that the hidden Markov
chain is in state *k* at time *t*, and *mu_k*
is the expected value of an observation given that the chain
is in state *k*.

If `means`

is `TRUE`

then the returned value is
a list with components

`probs` |
The conditional probabilities of the states at each time point. |

`means` |
The conditional expectations of the observations at each time point. |

Otherwise the returned value consists of `probs`

as
described above.

If there is a single vector of observations `y`

then
`probs`

is a matrix whose rows correspond to the states
of the hidden Markov chain, and whose columns correspond to
the observation times. If the observations consist of a
list of observation vectors, then `probs`

is a list
of such matrices, one for each vector of observations.

Likewise for the `means`

component of the list returned
when the argument `means`

is `TRUE`

.

Rolf Turner
[email protected]

`hmm()`

, `mps()`

,
`viterbi()`

, `pr()`

,
`fitted.hmm.discnp()`

1 2 3 4 5 6 7 8 | ```
P <- matrix(c(0.7,0.3,0.1,0.9),2,2,byrow=TRUE)
R <- matrix(c(0.5,0,0.1,0.1,0.3,
0.1,0.1,0,0.3,0.5),5,2)
set.seed(42)
y.num <- sim.hmm(rep(300,20),P,R)
fit.num <- hmm(y.num,K=2,verb=TRUE)
cpe1 <- sp(object=fit.num,means=TRUE) # Using the estimated parameters.
cpe2 <- sp(y.num,tpm=P,Rho=R,means=TRUE) # Using the ``true'' parameters.
``` |

```
hmm.discnp 0.2-4
PLEASE NOTE: The package has changed substantially
from the 0.0-x versions. New functions have been
added and both the argument lists and the returned
values from old functions have new forms. Please
read the ChangeLog and the documentation.
Initial set-up completed ...
Repeating ...
EM step 1:
Log-likelihood: -7922.866
Percent decrease in log-likelihood: 17.25897
Root-SS of change in coef.: 0.340697
Max. abs. change in coef.: 0.185699
EM step 2:
Log-likelihood: -7917.113
Percent decrease in log-likelihood: 0.072616
Root-SS of change in coef.: 0.013783
Max. abs. change in coef.: 0.008103
EM step 3:
Log-likelihood: -7909.047
Percent decrease in log-likelihood: 0.101882
Root-SS of change in coef.: 0.016665
Max. abs. change in coef.: 0.009646
EM step 4:
Log-likelihood: -7898.733
Percent decrease in log-likelihood: 0.130401
Root-SS of change in coef.: 0.019277
Max. abs. change in coef.: 0.010782
EM step 5:
Log-likelihood: -7886.88
Percent decrease in log-likelihood: 0.150066
Root-SS of change in coef.: 0.021213
Max. abs. change in coef.: 0.011464
EM step 6:
Log-likelihood: -7874.711
Percent decrease in log-likelihood: 0.154298
Root-SS of change in coef.: 0.022131
Max. abs. change in coef.: 0.012537
EM step 7:
Log-likelihood: -7863.551
Percent decrease in log-likelihood: 0.141708
Root-SS of change in coef.: 0.021841
Max. abs. change in coef.: 0.012981
EM step 8:
Log-likelihood: -7854.365
Percent decrease in log-likelihood: 0.116818
Root-SS of change in coef.: 0.020382
Max. abs. change in coef.: 0.012675
EM step 9:
Log-likelihood: -7847.49
Percent decrease in log-likelihood: 0.08753
Root-SS of change in coef.: 0.018058
Max. abs. change in coef.: 0.01169
EM step 10:
Log-likelihood: -7842.7
Percent decrease in log-likelihood: 0.061046
Root-SS of change in coef.: 0.015343
Max. abs. change in coef.: 0.010273
EM step 11:
Log-likelihood: -7839.478
Percent decrease in log-likelihood: 0.041087
Root-SS of change in coef.: 0.012707
Max. abs. change in coef.: 0.008723
EM step 12:
Log-likelihood: -7837.289
Percent decrease in log-likelihood: 0.027915
Root-SS of change in coef.: 0.01047
Max. abs. change in coef.: 0.007278
EM step 13:
Log-likelihood: -7835.724
Percent decrease in log-likelihood: 0.019977
Root-SS of change in coef.: 0.008765
Max. abs. change in coef.: 0.006068
EM step 14:
Log-likelihood: -7834.514
Percent decrease in log-likelihood: 0.01543
Root-SS of change in coef.: 0.00757
Max. abs. change in coef.: 0.005124
EM step 15:
Log-likelihood: -7833.508
Percent decrease in log-likelihood: 0.012846
Root-SS of change in coef.: 0.006781
Max. abs. change in coef.: 0.004422
EM step 16:
Log-likelihood: -7832.621
Percent decrease in log-likelihood: 0.011321
Root-SS of change in coef.: 0.006273
Max. abs. change in coef.: 0.003916
EM step 17:
Log-likelihood: -7831.811
Percent decrease in log-likelihood: 0.010342
Root-SS of change in coef.: 0.005939
Max. abs. change in coef.: 0.003557
EM step 18:
Log-likelihood: -7831.056
Percent decrease in log-likelihood: 0.009639
Root-SS of change in coef.: 0.005707
Max. abs. change in coef.: 0.003302
EM step 19:
Log-likelihood: -7830.346
Percent decrease in log-likelihood: 0.009075
Root-SS of change in coef.: 0.00553
Max. abs. change in coef.: 0.003118
EM step 20:
Log-likelihood: -7829.674
Percent decrease in log-likelihood: 0.008583
Root-SS of change in coef.: 0.005381
Max. abs. change in coef.: 0.002982
EM step 21:
Log-likelihood: -7829.037
Percent decrease in log-likelihood: 0.00813
Root-SS of change in coef.: 0.005247
Max. abs. change in coef.: 0.002877
EM step 22:
Log-likelihood: -7828.434
Percent decrease in log-likelihood: 0.007699
Root-SS of change in coef.: 0.005118
Max. abs. change in coef.: 0.002791
EM step 23:
Log-likelihood: -7827.864
Percent decrease in log-likelihood: 0.007281
Root-SS of change in coef.: 0.00499
Max. abs. change in coef.: 0.002716
EM step 24:
Log-likelihood: -7827.326
Percent decrease in log-likelihood: 0.006875
Root-SS of change in coef.: 0.004861
Max. abs. change in coef.: 0.002646
EM step 25:
Log-likelihood: -7826.819
Percent decrease in log-likelihood: 0.006479
Root-SS of change in coef.: 0.00473
Max. abs. change in coef.: 0.00258
EM step 26:
Log-likelihood: -7826.342
Percent decrease in log-likelihood: 0.006091
Root-SS of change in coef.: 0.004596
Max. abs. change in coef.: 0.002514
EM step 27:
Log-likelihood: -7825.895
Percent decrease in log-likelihood: 0.005714
Root-SS of change in coef.: 0.00446
Max. abs. change in coef.: 0.002447
EM step 28:
Log-likelihood: -7825.476
Percent decrease in log-likelihood: 0.005348
Root-SS of change in coef.: 0.004322
Max. abs. change in coef.: 0.00238
EM step 29:
Log-likelihood: -7825.086
Percent decrease in log-likelihood: 0.004993
Root-SS of change in coef.: 0.004182
Max. abs. change in coef.: 0.002311
EM step 30:
Log-likelihood: -7824.722
Percent decrease in log-likelihood: 0.00465
Root-SS of change in coef.: 0.004041
Max. abs. change in coef.: 0.00224
EM step 31:
Log-likelihood: -7824.384
Percent decrease in log-likelihood: 0.004321
Root-SS of change in coef.: 0.003899
Max. abs. change in coef.: 0.002169
EM step 32:
Log-likelihood: -7824.07
Percent decrease in log-likelihood: 0.004006
Root-SS of change in coef.: 0.003757
Max. abs. change in coef.: 0.002097
EM step 33:
Log-likelihood: -7823.781
Percent decrease in log-likelihood: 0.003705
Root-SS of change in coef.: 0.003616
Max. abs. change in coef.: 0.002024
EM step 34:
Log-likelihood: -7823.513
Percent decrease in log-likelihood: 0.00342
Root-SS of change in coef.: 0.003476
Max. abs. change in coef.: 0.001951
EM step 35:
Log-likelihood: -7823.267
Percent decrease in log-likelihood: 0.003149
Root-SS of change in coef.: 0.003337
Max. abs. change in coef.: 0.001877
EM step 36:
Log-likelihood: -7823.04
Percent decrease in log-likelihood: 0.002895
Root-SS of change in coef.: 0.003201
Max. abs. change in coef.: 0.001805
EM step 37:
Log-likelihood: -7822.832
Percent decrease in log-likelihood: 0.002656
Root-SS of change in coef.: 0.003066
Max. abs. change in coef.: 0.001732
EM step 38:
Log-likelihood: -7822.642
Percent decrease in log-likelihood: 0.002432
Root-SS of change in coef.: 0.002935
Max. abs. change in coef.: 0.001661
EM step 39:
Log-likelihood: -7822.468
Percent decrease in log-likelihood: 0.002224
Root-SS of change in coef.: 0.002806
Max. abs. change in coef.: 0.001591
EM step 40:
Log-likelihood: -7822.309
Percent decrease in log-likelihood: 0.00203
Root-SS of change in coef.: 0.002681
Max. abs. change in coef.: 0.001522
EM step 41:
Log-likelihood: -7822.165
Percent decrease in log-likelihood: 0.00185
Root-SS of change in coef.: 0.002559
Max. abs. change in coef.: 0.001455
EM step 42:
Log-likelihood: -7822.033
Percent decrease in log-likelihood: 0.001684
Root-SS of change in coef.: 0.002441
Max. abs. change in coef.: 0.001389
EM step 43:
Log-likelihood: -7821.913
Percent decrease in log-likelihood: 0.001531
Root-SS of change in coef.: 0.002327
Max. abs. change in coef.: 0.001326
EM step 44:
Log-likelihood: -7821.804
Percent decrease in log-likelihood: 0.001391
Root-SS of change in coef.: 0.002216
Max. abs. change in coef.: 0.001264
EM step 45:
Log-likelihood: -7821.706
Percent decrease in log-likelihood: 0.001262
Root-SS of change in coef.: 0.00211
Max. abs. change in coef.: 0.001205
EM step 46:
Log-likelihood: -7821.616
Percent decrease in log-likelihood: 0.001144
Root-SS of change in coef.: 0.002007
Max. abs. change in coef.: 0.001147
EM step 47:
Log-likelihood: -7821.535
Percent decrease in log-likelihood: 0.001036
Root-SS of change in coef.: 0.001909
Max. abs. change in coef.: 0.001092
EM step 48:
Log-likelihood: -7821.462
Percent decrease in log-likelihood: 0.000938
Root-SS of change in coef.: 0.001814
Max. abs. change in coef.: 0.001038
EM step 49:
Log-likelihood: -7821.395
Percent decrease in log-likelihood: 0.000849
Root-SS of change in coef.: 0.001724
Max. abs. change in coef.: 0.000987
EM step 50:
Log-likelihood: -7821.335
Percent decrease in log-likelihood: 0.000769
Root-SS of change in coef.: 0.001638
Max. abs. change in coef.: 0.000938
EM step 51:
Log-likelihood: -7821.281
Percent decrease in log-likelihood: 0.000695
Root-SS of change in coef.: 0.001555
Max. abs. change in coef.: 0.000891
EM step 52:
Log-likelihood: -7821.232
Percent decrease in log-likelihood: 0.000629
Root-SS of change in coef.: 0.001476
Max. abs. change in coef.: 0.000847
EM step 53:
Log-likelihood: -7821.187
Percent decrease in log-likelihood: 0.000569
Root-SS of change in coef.: 0.001401
Max. abs. change in coef.: 0.000804
EM step 54:
Log-likelihood: -7821.147
Percent decrease in log-likelihood: 0.000515
Root-SS of change in coef.: 0.001329
Max. abs. change in coef.: 0.000763
EM step 55:
Log-likelihood: -7821.11
Percent decrease in log-likelihood: 0.000466
Root-SS of change in coef.: 0.001261
Max. abs. change in coef.: 0.000724
EM step 56:
Log-likelihood: -7821.077
Percent decrease in log-likelihood: 0.000422
Root-SS of change in coef.: 0.001196
Max. abs. change in coef.: 0.000688
EM step 57:
Log-likelihood: -7821.048
Percent decrease in log-likelihood: 0.000382
Root-SS of change in coef.: 0.001135
Max. abs. change in coef.: 0.000652
EM step 58:
Log-likelihood: -7821.021
Percent decrease in log-likelihood: 0.000346
Root-SS of change in coef.: 0.001076
Max. abs. change in coef.: 0.000619
EM step 59:
Log-likelihood: -7820.996
Percent decrease in log-likelihood: 0.000314
Root-SS of change in coef.: 0.001021
Max. abs. change in coef.: 0.000587
EM step 60:
Log-likelihood: -7820.974
Percent decrease in log-likelihood: 0.000285
Root-SS of change in coef.: 0.000969
Max. abs. change in coef.: 0.000557
EM step 61:
Log-likelihood: -7820.953
Percent decrease in log-likelihood: 0.000259
Root-SS of change in coef.: 0.000919
Max. abs. change in coef.: 0.000529
EM step 62:
Log-likelihood: -7820.935
Percent decrease in log-likelihood: 0.000235
Root-SS of change in coef.: 0.000872
Max. abs. change in coef.: 0.000502
EM step 63:
Log-likelihood: -7820.918
Percent decrease in log-likelihood: 0.000214
Root-SS of change in coef.: 0.000827
Max. abs. change in coef.: 0.000476
EM step 64:
Log-likelihood: -7820.903
Percent decrease in log-likelihood: 0.000195
Root-SS of change in coef.: 0.000785
Max. abs. change in coef.: 0.000452
EM step 65:
Log-likelihood: -7820.889
Percent decrease in log-likelihood: 0.000178
Root-SS of change in coef.: 0.000745
Max. abs. change in coef.: 0.000429
EM step 66:
Log-likelihood: -7820.877
Percent decrease in log-likelihood: 0.000162
Root-SS of change in coef.: 0.000707
Max. abs. change in coef.: 0.000407
EM step 67:
Log-likelihood: -7820.865
Percent decrease in log-likelihood: 0.000148
Root-SS of change in coef.: 0.000671
Max. abs. change in coef.: 0.000386
EM step 68:
Log-likelihood: -7820.854
Percent decrease in log-likelihood: 0.000136
Root-SS of change in coef.: 0.000637
Max. abs. change in coef.: 0.000367
EM step 69:
Log-likelihood: -7820.845
Percent decrease in log-likelihood: 0.000124
Root-SS of change in coef.: 0.000605
Max. abs. change in coef.: 0.000349
EM step 70:
Log-likelihood: -7820.836
Percent decrease in log-likelihood: 0.000114
Root-SS of change in coef.: 0.000575
Max. abs. change in coef.: 0.000331
EM step 71:
Log-likelihood: -7820.828
Percent decrease in log-likelihood: 0.000105
Root-SS of change in coef.: 0.000546
Max. abs. change in coef.: 0.000314
EM step 72:
Log-likelihood: -7820.82
Percent decrease in log-likelihood: 9.6e-05
Root-SS of change in coef.: 0.000519
Max. abs. change in coef.: 0.000299
Warning message:
In check.yval(y, Rho) : Matrix "Rho" has no row names. Assuming that the
rows of Rho correspond to the sorted unique values of "y".
```

hmm.discnp documentation built on May 29, 2017, 12:28 p.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.