[Depmix-commits] r404 - pkg/depmixS4/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Mar 9 17:21:10 CET 2010


Author: ingmarvisser
Date: 2010-03-09 17:21:10 +0100 (Tue, 09 Mar 2010)
New Revision: 404

Modified:
   pkg/depmixS4/R/lystig.R
   pkg/depmixS4/R/makeDepmix.R
Log:
Added error message in case ntimes in response models and in prior model are in conflict

Modified: pkg/depmixS4/R/lystig.R
===================================================================
--- pkg/depmixS4/R/lystig.R	2010-03-09 12:43:42 UTC (rev 403)
+++ pkg/depmixS4/R/lystig.R	2010-03-09 16:21:10 UTC (rev 404)
@@ -34,7 +34,7 @@
 		et <- cumsum(ntimes)
 		bt <- c(1,et[-lt]+1)
 				
-		ll <- 0		
+# 		ll <- 0	
 		
 		for(case in 1:lt) { # multiple cases
 			phi[bt[case],] <- init[case,]*B[bt[case],] # initialize case
Modified: pkg/depmixS4/R/makeDepmix.R
===================================================================
--- pkg/depmixS4/R/makeDepmix.R	2010-03-09 12:43:42 UTC (rev 403)
+++ pkg/depmixS4/R/makeDepmix.R	2010-03-09 16:21:10 UTC (rev 404)
@@ -78,6 +78,9 @@
 	# compute initial state probabilties
 	init <- dens(prior)
 	
+	# check if dim(init) agrees ntimes
+	if(!(dim(init)[1]==length(ntimes))) stop("Argument 'ntimes' does not agree with dimension of prior model.")
+	
 	new("depmix",response=response,transition=transition,prior=prior,
 		dens=dens,trDens=trDens,init=init,stationary=stationary,
 		ntimes=ntimes,nstates=nstates,nresp=nresp,npars=npars)



More information about the depmix-commits mailing list