[Depmix-commits] r228 - trunk/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Oct 10 01:16:41 CEST 2008
Author: maarten
Date: 2008-10-10 01:16:41 +0200 (Fri, 10 Oct 2008)
New Revision: 228
Modified:
trunk/R/responseGLM.R
Log:
- fixed problem in GLMresponse with family=binomial() (treated parameters as matrix)
- in GLMbinomial, starting values are no longer automatically transformed with an inverse link (now only for bi/multi-nomial, if prob=true and only for intercept
Modified: trunk/R/responseGLM.R
===================================================================
--- trunk/R/responseGLM.R 2008-09-07 21:10:51 UTC (rev 227)
+++ trunk/R/responseGLM.R 2008-10-09 23:16:41 UTC (rev 228)
@@ -75,18 +75,16 @@
pstart <- matrix(pstart,ncol(x),byrow=TRUE)
if(ncol(x)>1) parameters$coefficients[2:ncol(x),] <- pstart[2:ncol(x),]
} else {
- parameters$coefficients <- family$linkfun(as.numeric(pstart[1:length(parameters$coefficients)]))
+ # if(prob) parameters$coefficients <- family$linkfun(as.numeric(pstart[1:length(parameters$coefficients)]))
+ if(family$family=="binomial") {
+ if(prob) parameters$coefficients[1] <- family$linkfun(pstart[1])
+ else parameters$coefficients[1] <- pstart[1]
+ if(ncol(x)>1) parameters$coefficients[2:ncol(x)] <- pstart[2:ncol(x)]
+ }
+ if(length(unlist(parameters))>length(parameters$coefficients)) {
+ if(family$family=="gaussian") parameters$sd <- as.numeric(pstart[(length(parameters$coefficients)+1)])
+ }
}
-
- if(family$family=="binomial") {
- if(prob) parameters$coefficients[1] <- family$linkfun(pstart[1])
- else parameters$coefficients[1] <- pstart[1]
- if(ncol(x)>1) parameters$coefficients[2:ncol(x),] <- pstart[2:ncol(x),]
- }
-
- if(length(unlist(parameters))>length(parameters$coefficients)) {
- if(family$family=="gaussian") parameters$sd <- as.numeric(pstart[(length(parameters$coefficients)+1)])
- }
}
mod <- switch(family$family,
gaussian = new("NORMresponse",formula=formula,family=family,parameters=parameters,fixed=fixed,x=x,y=y,npar=npar),
More information about the depmix-commits
mailing list