[Depmix-commits] r371 - trunk/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 25 22:54:31 CET 2010


Author: ingmarvisser
Date: 2010-02-25 22:54:31 +0100 (Thu, 25 Feb 2010)
New Revision: 371

Modified:
   trunk/R/depmixfit-class.R
Log:
Added argument which to summary of fitted objects such that summary info can be limited to eg only the transition parameters

Modified: trunk/R/depmixfit-class.R
===================================================================
--- trunk/R/depmixfit-class.R	2010-02-25 21:53:44 UTC (rev 370)
+++ trunk/R/depmixfit-class.R	2010-02-25 21:54:31 UTC (rev 371)
@@ -38,20 +38,28 @@
 )
 
 setMethod("summary","mix.fitted",
-	function(object) {
-		cat("Mixture probabilities model \n")
-		print(object at prior)
-		cat("\n")
-		for(i in 1:object at nstates) {
-			cat("Response model(s) for state", i,"\n\n")
-			for(j in 1:object at nresp) {
-				cat("Response model for response",j,"\n")
-				print(object at response[[i]][[j]])
+	function(object,which="all") {
+		ans=switch(which,
+			"all" = 1,
+			"response" = 2,
+			"prior" = 3)
+		if(ans==1|ans==3) {
+			cat("Mixture probabilities model \n")
+			print(object at prior)
+			cat("\n")
+		}
+		if(ans==1|ans==2) {
+			for(i in 1:object at nstates) {
+				cat("Response model(s) for state", i,"\n\n")
+				for(j in 1:object at nresp) {
+					cat("Response model for response",j,"\n")
+					print(object at response[[i]][[j]])
+					cat("\n")
+				}
 				cat("\n")
 			}
-			cat("\n")
 		}
-	}
+	}	
 )
 
 # 
@@ -90,25 +98,36 @@
 )
 
 setMethod("summary","depmix.fitted",
-	function(object) {
-		cat("Initial state probabilties model \n")
-		print(object at prior)
-		cat("\n")
-		for(i in 1:object at nstates) {
-			cat("Transition model for state (component)", i,"\n")
-			print(object at transition[[i]])
+	function(object,which="all") {
+		ans=switch(which,
+			"all" = 1,
+			"response" = 2,
+			"prior" = 3,
+			"transition" = 4)
+		if(ans==1|ans==3) {
+			cat("Initial state probabilties model \n")
+			print(object at prior)
 			cat("\n")
 		}
-		cat("\n")
-		for(i in 1:object at nstates) {
-			cat("Response model(s) for state", i,"\n\n")
-			for(j in 1:object at nresp) {
-				cat("Response model for response",j,"\n")
-				print(object at response[[i]][[j]])
+		if(ans==1|ans==4) {
+			for(i in 1:object at nstates) {
+				cat("Transition model for state (component)", i,"\n")
+				print(object at transition[[i]])
 				cat("\n")
 			}
 			cat("\n")
 		}
+		if(ans==1|ans==2) {
+			for(i in 1:object at nstates) {
+				cat("Response model(s) for state", i,"\n\n")
+				for(j in 1:object at nresp) {
+					cat("Response model for response",j,"\n")
+					print(object at response[[i]][[j]])
+					cat("\n")
+				}
+				cat("\n")
+			}
+		}
 	}
 )
 


More information about the depmix-commits mailing list