| responses {depmixS4} | R Documentation |
Depmix contains a number of default response models. We provide a brief description of these here.
BINOMresponse is a binomial response model. It derives from the basic
GLMresponse class.
GAMMAresponse is a model for a Gamma distributed response.
It extends the basic GLMresponse class directly.
MULTINOMresponse is a model for a multinomial distributed response.
It extends the basic GLMresponse class, although the
functionality is somewhat different from other models that do so.
ncol(x) by ncol(y) matrix which contains the GLM
coefficients.
MVNresponse is a model for a multivariate normal distributed response.
NORMresponse is a model for a normal (Gaussian) distributed response.
It extends the basic GLMresponse class directly.
POISSONresponse is a model for a Poisson distributed response.
It extends the basic GLMresponse class directly.
Maarten Speekenbrink & Ingmar Visser
mod <- GLMresponse(rnorm(1000)~1)
fit(mod)
mod <- GLMresponse(sample(1:3,1000,rep=TRUE)~1,family=multinomial())
fit(mod)
colSums(mod@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@y <- simulate(mod)
fit(mod)
colSums(mod@y[which(x==0),])/length(which(x==0))
colSums(mod@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)
glm(cbind(ss,1-ss)~x, family=binomial)
x <- abs(rnorm(1000,2))
res <- rpois(1000,x)
mod <- GLMresponse(res~x,family=poisson())
fit(mod)
glm(res~x, family=poisson)
x=runif(1000,1,5)
res <- rgamma(1000,x)
## note that gamma needs proper starting values which are not
## provided by depmixS4 (even with them, this may produce warnings)
mod <- GLMresponse(res~x,family=Gamma(),pst=c(0.8,1/0.8))
fit(mod)
glm(res~x,family=Gamma)
mn <- c(1,2,3)
sig <- matrix(c(1,.5,0,.5,1,0,0,0,2),3,3)
y <- mvrnorm(1000,mn,sig)
mod <- MVNresponse(y~1)
fit(mod)
colMeans(y)
var(y)