[Depmix-commits] r95 - trunk/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 20 12:55:31 CET 2008


Author: maarten
Date: 2008-03-20 12:55:31 +0100 (Thu, 20 Mar 2008)
New Revision: 95

Modified:
   trunk/R/viterbi.R
Log:
- fixed bug in Viterbi (for stationary models)

Modified: trunk/R/viterbi.R
===================================================================
--- trunk/R/viterbi.R	2008-03-20 11:34:45 UTC (rev 94)
+++ trunk/R/viterbi.R	2008-03-20 11:55:31 UTC (rev 95)
@@ -22,8 +22,13 @@
       # recursion
       for(i in ((bt[case]+1):et[case])) {
           for(j in 1:ns) {
-              delta[i,j] <- min(delta[i-1,] - log(A[i,,j])) - B[i,j]
-              k <- which.min(delta[i-1,] - log(A[i,,j]))
+              if(!object at stationary) {
+                delta[i,j] <- min(delta[i-1,] - log(A[i,,j])) - B[i,j]
+                k <- which.min(delta[i-1,] - log(A[i,,j]))
+              } else {
+                delta[i,j] <- min(delta[i-1,] - log(A[,,j])) - B[i,j]
+                k <- which.min(delta[i-1,] - log(A[,,j]))
+              }
               if(length(k) == 0) k <- 0
               psi[i,j] <- k
           }



More information about the depmix-commits mailing list