[Depmix-commits] r158 - trunk/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 13 16:08:02 CEST 2008
Author: maarten
Date: 2008-06-13 16:08:02 +0200 (Fri, 13 Jun 2008)
New Revision: 158
Modified:
trunk/R/responseGLMMULTINOM.R
Log:
- fixed bug in multinom
Modified: trunk/R/responseGLMMULTINOM.R
===================================================================
--- trunk/R/responseGLMMULTINOM.R 2008-06-12 13:44:52 UTC (rev 157)
+++ trunk/R/responseGLMMULTINOM.R 2008-06-13 14:08:02 UTC (rev 158)
@@ -7,13 +7,14 @@
base <- object at family$base # delete me
y <- object at y
x <- object at x
+ #if(is.null(w)) w <- rep(1,nrow(y))
mask <- matrix(1,nrow=nrow(pars$coefficients),ncol=ncol(pars$coefficients))
mask[,base] <- 0 # fix base category coefficients to 0
mask <- rbind(0,mask) # fix "bias" nodes to 0
Wts <- mask
Wts[-1,] <- t(pars$coefficients) # set starting weights
fit <- nnet.default(x,y,weights=w,size=0,entropy=TRUE,skip=TRUE,mask=mask,Wts=Wts,trace=FALSE)
- pars$coefficients <- matrix(fit$wts,ncol=ncol(pars$coefficients),nrow=nrow(pars$coefficients)+1,byrow=TRUE)[-1,]
+ pars$coefficients <- matrix(fit$wts,ncol=ncol(pars$coefficients),nrow=nrow(pars$coefficients)+1)[-1,]
object <- setpars(object,unlist(pars))
object
}
More information about the depmix-commits
mailing list