[Depmix-commits] r568 - pkg/depmixS4/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 18 21:34:30 CEST 2012
Author: maarten
Date: 2012-09-18 21:34:30 +0200 (Tue, 18 Sep 2012)
New Revision: 568
Modified:
pkg/depmixS4/R/depmix-class.R
Log:
adapted depmix summary method so that mlogit transition matrices are also displayed as probabilities
Modified: pkg/depmixS4/R/depmix-class.R
===================================================================
--- pkg/depmixS4/R/depmix-class.R 2012-09-18 11:01:46 UTC (rev 567)
+++ pkg/depmixS4/R/depmix-class.R 2012-09-18 19:34:30 UTC (rev 568)
@@ -378,6 +378,9 @@
cat("\nTransition matrix \n")
pars <- getpars(object)
trm <- matrix(pars[(ns+1):(ns^2+ns)],ns,ns,byr=T)
+ if(object at transition[[1]]@family$link == "mlogit") {
+ trm <- t(apply(trm,1,object at transition[[1]]@family$linkinv,base=object at transition[[1]]@family$base))
+ }
rownames(trm) <- paste("fromS",1:ns,sep="")
colnames(trm) <- paste("toS",1:ns,sep="")
print(trm)
@@ -411,7 +414,7 @@
pars <- list()
np <- numeric(object at nresp)
for(j in 1:object at nresp) {
- np[j] <- npar(object at response[[1]][[j]])
+ np[j] <- npar(object at response[[1]][[j]]) # this will not always work!
pars[[j]] <- matrix(,nr=ns,nc=np[j])
}
allpars <- matrix(,nr=ns,nc=0)
More information about the depmix-commits
mailing list