[Depmix-commits] r183 - trunk/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 24 16:23:40 CEST 2008
Author: ingmarvisser
Date: 2008-06-24 16:23:39 +0200 (Tue, 24 Jun 2008)
New Revision: 183
Modified:
trunk/man/responses.Rd
Log:
Added examples to responses.Rd
Modified: trunk/man/responses.Rd
===================================================================
--- trunk/man/responses.Rd 2008-06-24 14:15:26 UTC (rev 182)
+++ trunk/man/responses.Rd 2008-06-24 14:23:39 UTC (rev 183)
@@ -105,31 +105,50 @@
\section{examples}{
+ mod <- GLMresponse(rnorm(1000)~1)
+ fit(mod)
+
mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
fit(mod)
+ colSums(mod at y)/1000
+ x <- sample(0:1,1000,rep=TRUE)
+ mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~x,family=multinomial(),pstart=c(0.33,0.33,0.33,0,0,1))
+ mod at y <- simulate(mod)
+ fit(mod)
+ colSums(mod at y[which(x==0),])/length(which(x==0))
+ colSums(mod at y[which(x==1),])/length(which(x==1))
+
x <- rnorm(1000)
+ library(boot)
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())
+ glm(cbind(ss,1-ss)~x, family=binomial)
+
+ x <- rnorm(1000,2)^2
+ res <- rpois(1000,x)
+ mod <- GLMresponse(res~x,family=poisson())
fit(mod)
-
- mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+
+ glm(res~x, family=poisson)
+
+ x=runif(1000,1,5)
+ res <- rgamma(1000,x)
+ mod <- GLMresponse(res~x,family=Gamma())
fit(mod)
-
- mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
+
+ glm(res~x,family=Gamma)
+
+ library(mvtnorm)
+ mn <- c(1,2,3)
+ sig <- matrix(c(1,.5,0,.5,1,0,0,0,2),3,3)
+ y <- rmvnorm(1000,mn,sig)
+ mod <- MVNresponse(y)
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}
More information about the depmix-commits
mailing list