[Depmix-commits] r179 - in trunk: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 24 15:07:52 CEST 2008


Author: ingmarvisser
Date: 2008-06-24 15:07:52 +0200 (Tue, 24 Jun 2008)
New Revision: 179

Modified:
   trunk/R/responseGLM.R
   trunk/man/responses.Rd
Log:
Added default w=NULL in the fit function for GLMresponse objects

Modified: trunk/R/responseGLM.R
===================================================================
--- trunk/R/responseGLM.R	2008-06-20 13:38:08 UTC (rev 178)
+++ trunk/R/responseGLM.R	2008-06-24 13:07:52 UTC (rev 179)
@@ -178,7 +178,7 @@
 # returns: (fitted) response with (new) estimates of parameters
 
 setMethod("fit","GLMresponse",
-	function(object,w) {
+	function(object,w=NULL) {
 		pars <- object at parameters
 		fit <- glm.fit(x=object at x,y=object at y,weights=w,family=object at family,start=pars$coefficients)
 		pars$coefficients <- fit$coefficients
Modified: trunk/man/responses.Rd
===================================================================
--- trunk/man/responses.Rd	2008-06-20 13:38:08 UTC (rev 178)
+++ trunk/man/responses.Rd	2008-06-24 13:07:52 UTC (rev 179)
@@ -103,6 +103,35 @@
 
 }
 
+\section{examples}{
+	
+	mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+	fit(mod)
+	
+	x <- rnorm(1000)
+	p <- inv.logit(x)
+	ss <- rbinom(1000,1,p)
+	mod <- GLMresponse(cbind(ss,1-ss)~x,family=binomial())
+	fit(mod)
+	
+	mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+	fit(mod)
+
+	mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+	fit(mod)
+
+	mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+	fit(mod)
+
+	mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+	fit(mod)
+
+	mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+	fit(mod)
+
+
+}
+
 \author{Maarten Speekenbrink}
 
 \keyword{models}



More information about the depmix-commits mailing list