[Depmix-commits] r589 - in pkg/depmixS4: R inst/doc man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 13 16:25:31 CEST 2013
Author: ingmarvisser
Date: 2013-09-13 16:25:31 +0200 (Fri, 13 Sep 2013)
New Revision: 589
Modified:
pkg/depmixS4/R/EM.R
pkg/depmixS4/R/allGenerics.R
pkg/depmixS4/R/depmix-class.R
pkg/depmixS4/R/depmix.R
pkg/depmixS4/R/fb.R
pkg/depmixS4/R/forwardbackward.R
pkg/depmixS4/R/logLik.R
pkg/depmixS4/R/lystig.R
pkg/depmixS4/R/makeDepmix.R
pkg/depmixS4/R/makeTransModels.R
pkg/depmixS4/R/transInit.R
pkg/depmixS4/R/viterbi.R
pkg/depmixS4/inst/doc/depmixS4.Rnw
pkg/depmixS4/man/depmix-class.Rd
pkg/depmixS4/man/depmix.sim-class.Rd
pkg/depmixS4/man/makeDepmix.Rd
Log:
Replaced stationary with homogenous as class slot in depmix models and as argument in function makeDepmix. In the latter the stationary argument is retained with default value NULL and a warning is given when it is used.
Modified: pkg/depmixS4/R/EM.R
===================================================================
--- pkg/depmixS4/R/EM.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/EM.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -24,7 +24,7 @@
out
}
-emviterbi <- function(A,B,init,ntimes,nstates,stationary,na.allow=TRUE) {
+emviterbi <- function(A,B,init,ntimes,nstates,homogeneous,na.allow=TRUE) {
# used for EM with hard classification, so that we don't need to change the object...
# returns the most likely state sequence
nt <- sum(ntimes)
@@ -53,7 +53,7 @@
if(ntimes[case]>1) {
for(tt in ((bt[case]+1):et[case])) {
for(j in 1:ns) {
- if(!stationary) {
+ if(!homogeneous) {
delta[tt,j] <- max(delta[tt-1,]*(A[tt,j,]))*B[tt,j]
k <- which.max(delta[tt-1,]*A[tt,j,])
} else {
@@ -288,7 +288,7 @@
# initial expectation
if(clsf == "hard") {
fbo <- list()
- vstate <- emviterbi(A=trDens,B=dens,init=init,ntimes=object at ntimes,nstates=ns,stationary=object at stationary,na.allow=na.allow)[,1]
+ vstate <- emviterbi(A=trDens,B=dens,init=init,ntimes=object at ntimes,nstates=ns,homogeneous=object at homogeneous,na.allow=na.allow)[,1]
fbo$gamma <- as.matrix(model.matrix(~ factor(vstate,levels=1:ns) - 1))
fbo$xi <- array(0,dim=c(sum(ntimes),ns,ns))
fbo$xi[cbind(1:(sum(ntimes)- 1),vstate[-1],vstate[-length(vstate)])] <- 1
@@ -296,7 +296,7 @@
if(na.allow) B[is.na(B)] <- 1
fbo$logLike <- sum(log((apply(B,c(1,3),prod))[cbind(1:sum(ntimes),vstate)]))
} else {
- fbo <- fb(init=init,A=trDens,B=dens,ntimes=ntimes(object),stationary=object at stationary)
+ fbo <- fb(init=init,A=trDens,B=dens,ntimes=ntimes(object),homogeneous=object at homogeneous)
}
LL <- fbo$logLike
if(is.nan(LL)) stop("Starting values not feasible; please provide them.")
@@ -312,7 +312,7 @@
trm <- matrix(0,ns,ns)
for(i in 1:ns) {
- if(!object at stationary) {
+ if(!object at homogeneous) {
transition[[i]]@y <- fbo$xi[,,i]/fbo$gamma[,i]
transition[[i]] <- fit(transition[[i]],w=as.matrix(fbo$gamma[,i]),ntimes=ntimes(object)) # check this
} else {
@@ -341,7 +341,7 @@
if(clsf == "hard") {
fbo <- list()
- vstate <- emviterbi(A=trDens,B=dens,init=init,ntimes=object at ntimes,nstates=ns,stationary=object at stationary,na.allow=na.allow)[,1]
+ vstate <- emviterbi(A=trDens,B=dens,init=init,ntimes=object at ntimes,nstates=ns,homogeneous=object at homogeneous,na.allow=na.allow)[,1]
#vstate <- viterbi(object)[,1]
fbo$gamma <- as.matrix(model.matrix(~ factor(vstate,levels=1:ns) - 1))
fbo$xi <- array(0,dim=c(sum(ntimes),ns,ns))
@@ -351,7 +351,7 @@
fbo$logLike <- sum(log((apply(B,c(1,3),prod))[cbind(1:sum(ntimes),vstate)]))
} else {
# expectation
- fbo <- fb(init=init,A=trDens,B=dens,ntimes=ntimes(object),stationary=object at stationary)
+ fbo <- fb(init=init,A=trDens,B=dens,ntimes=ntimes(object),homogeneous=object at homogeneous)
}
LL <- fbo$logLike
Modified: pkg/depmixS4/R/allGenerics.R
===================================================================
--- pkg/depmixS4/R/allGenerics.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/allGenerics.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -44,7 +44,7 @@
setGeneric("getConstraints", function(object, ...) standardGeneric("getConstraints"))
-setGeneric("is.stationary", function(object,...) standardGeneric("is.stationary"))
+setGeneric("is.homogeneous", function(object,...) standardGeneric("is.homogeneous"))
setGeneric("setpars", function(object,values,which="pars",...) standardGeneric("setpars"))
Modified: pkg/depmixS4/R/depmix-class.R
===================================================================
--- pkg/depmixS4/R/depmix-class.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/depmix-class.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -44,7 +44,7 @@
function(object) return(object at nresp)
)
-setMethod("is.stationary",signature(object="mix"),
+setMethod("is.homogeneous",signature(object="mix"),
function(object) {
return(TRUE)
}
@@ -223,7 +223,7 @@
setClass("depmix",
representation(transition="list", # transition models (multinomial logistic)
trDens="array", # transition densities (A)
- stationary="logical"
+ homogeneous="logical"
),
contains="mix"
)
@@ -256,9 +256,9 @@
}
)
-setMethod("is.stationary",signature(object="depmix"),
+setMethod("is.homogeneous",signature(object="depmix"),
function(object) {
- return(object at stationary)
+ return(object at homogeneous)
}
)
@@ -284,7 +284,7 @@
states[bt,] <- simulate(object at prior,nsim=nsim,is.prior=TRUE)
sims <- array(,dim=c(nt,ns,nsim))
for(i in 1:ns) {
- if(is.stationary(object)) {
+ if(is.homogeneous(object)) {
# TODO: this is a temporary fix!!!
sims[,i,] <- simulate(object at transition[[i]],nsim=nsim,times=rep(1,nt))
} else {
@@ -315,7 +315,7 @@
object at prior@x <- as.matrix(apply(object at prior@x,2,rep,nsim))
for(j in 1:ns) {
- if(!is.stationary(object)) object at transition[[j]]@x <- as.matrix(apply(object at transition[[j]]@x,2,rep,nsim))
+ if(!is.homogeneous(object)) object at transition[[j]]@x <- as.matrix(apply(object at transition[[j]]@x,2,rep,nsim))
for(i in 1:nr) {
object at response[[j]][[i]]@y <- as.matrix(responses[[i]])
object at response[[j]][[i]]@x <- as.matrix(apply(object at response[[j]][[i]]@x,2,rep,nsim))
@@ -325,7 +325,7 @@
# make appropriate array for transition densities
nt <- sum(object at ntimes)
- if(is.stationary(object)) trDens <- array(0,c(1,ns,ns)) else trDens <- array(0,c(nt,ns,ns))
+ if(is.homogeneous(object)) trDens <- array(0,c(1,ns,ns)) else trDens <- array(0,c(nt,ns,ns))
# make appropriate array for response densities
dns <- array(,c(nt,nr,ns))
Modified: pkg/depmixS4/R/depmix.R
===================================================================
--- pkg/depmixS4/R/depmix.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/depmix.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -35,7 +35,7 @@
prior <- makePriorModel(nstates = nstates, ncases = length(ntimes),
formula = prior, data = initdata, values = instart)
- # call main depmix with all these models, ntimes and stationary
+ # call main depmix with all these models, ntimes and homogeneous
model <- makeMix(response = response, prior = prior)
return(model)
@@ -77,19 +77,19 @@
nstates = nstates, family = family, values = respstart)
# make transition models
- stationary = FALSE
+ homogeneous = FALSE
if (transition == ~1)
- stationary = TRUE
+ homogeneous = TRUE
transition <- makeTransModels(nstates = nstates, formula = transition,
- data = data, stationary = stationary, values = trstart)
+ data = data, homogeneous = homogeneous, values = trstart)
# make prior model
prior <- makePriorModel(nstates = nstates, ncases = length(ntimes),
formula = prior, data = initdata, values = instart)
- # call main depmix with all these models, ntimes and stationary
+ # call main depmix with all these models, ntimes and homogeneous
model <- makeDepmix(response = response, transition = transition,
- prior = prior, ntimes = ntimes, stationary = stationary)
+ prior = prior, ntimes = ntimes, homogeneous = homogeneous)
# deal with starting values here!!!!!!
Modified: pkg/depmixS4/R/fb.R
===================================================================
--- pkg/depmixS4/R/fb.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/fb.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -4,7 +4,7 @@
# FORWARD-BACKWARD algoritme, 23-3-2008
#
-fb <- function(init,A,B,ntimes=NULL,return.all=FALSE,stationary=TRUE,useC=TRUE,na.allow=TRUE) {
+fb <- function(init,A,B,ntimes=NULL,return.all=FALSE,homogeneous=TRUE,useC=TRUE,na.allow=TRUE) {
# Forward-Backward algorithm (used in Baum-Welch)
# Returns alpha, beta, and full data likelihood
@@ -47,7 +47,7 @@
xi <- array(0,dim=c(nt,ns,ns))
res <- .C("forwardbackward",
- hom=as.integer(stationary),
+ hom=as.integer(homogeneous),
ns=as.integer(ns),
lt=as.integer(lt),
nt=as.integer(nt),
@@ -83,7 +83,7 @@
if(ntimes[case]>1) {
for(i in bt[case]:(et[case]-1)) {
- if(stationary) alpha[i+1,] <- (A[1,,]%*%alpha[i,])*B[i+1,]
+ if(homogeneous) alpha[i+1,] <- (A[1,,]%*%alpha[i,])*B[i+1,]
else alpha[i+1,] <- (A[i,,]%*%alpha[i,])*B[i+1,]
sca[i+1] <- 1/sum(alpha[i+1,])
alpha[i+1,] <- sca[i+1]*alpha[i+1,]
@@ -94,12 +94,12 @@
if(ntimes[case]>1) {
for(i in (et[case]-1):bt[case]) {
- if(stationary) beta[i,] <-(B[i+1,]*beta[i+1,])%*%A[1,,]*sca[i]
+ if(homogeneous) beta[i,] <-(B[i+1,]*beta[i+1,])%*%A[1,,]*sca[i]
else beta[i,] <-(B[i+1,]*beta[i+1,])%*%A[i,,]*sca[i]
}
for(i in bt[case]:(et[case]-1)) {
- if(stationary) xi[i,,] <- rep(alpha[i,],each=ns)*(B[i+1,]*beta[i+1,]*A[1,,])
+ if(homogeneous) xi[i,,] <- rep(alpha[i,],each=ns)*(B[i+1,]*beta[i+1,]*A[1,,])
else xi[i,,] <- rep(alpha[i,],each=ns)*(B[i+1,]*beta[i+1,]*A[i,,])
}
}
Modified: pkg/depmixS4/R/forwardbackward.R
===================================================================
--- pkg/depmixS4/R/forwardbackward.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/forwardbackward.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -7,14 +7,14 @@
setMethod("forwardbackward","depmix",
function(object, return.all=TRUE, useC=TRUE, ...) {
fb(init=object at init,A=object at trDens,B=object at dens,ntimes=ntimes(object),
- stationary=object at stationary,return.all=return.all,useC=useC)
+ homogeneous=object at homogeneous,return.all=return.all,useC=useC)
}
)
setMethod("forwardbackward","mix",
function(object, return.all=TRUE, useC=TRUE, ...) {
fb(init=object at init,matrix(0,1,1),B=object at dens,ntimes=ntimes(object),
- stationary=TRUE,return.all=return.all,useC=useC)
+ homogeneous=TRUE,return.all=return.all,useC=useC)
}
)
Modified: pkg/depmixS4/R/logLik.R
===================================================================
--- pkg/depmixS4/R/logLik.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/logLik.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -4,8 +4,8 @@
function(object,method=c("fb","lystig","classification"),na.allow=TRUE) {
#4/5/2012: set to fb as this is now in C
method <- match.arg(method)
- if(method=="fb") ll <- fb(init=object at init,A=object at trDens,B=object at dens,ntimes=object at ntimes,stationary=object at stationary,na.allow=na.allow)$logLike
- if(method=="lystig") ll <- lystig(init=object at init,A=object at trDens,B=object at dens,ntimes=object at ntimes,stationary=object at stationary)$logLike
+ if(method=="fb") ll <- fb(init=object at init,A=object at trDens,B=object at dens,ntimes=object at ntimes,homogeneous=object at homogeneous,na.allow=na.allow)$logLike
+ if(method=="lystig") ll <- lystig(init=object at init,A=object at trDens,B=object at dens,ntimes=object at ntimes,homogeneous=object at homogeneous)$logLike
if(method=="classification") {
ns <- nstates(object)
ntimes <- ntimes(object)
@@ -33,11 +33,11 @@
#function(object,method="lystig") {
function(object,method=c("fb","lystig","classification"),na.allow=TRUE) {
method <- match.arg(method)
- if(method=="fb") ll <- fb(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=object at ntimes,stationary=TRUE)$logLike
- if(method=="lystig") ll <- lystig(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=object at ntimes,stationary=TRUE)$logLike
+ if(method=="fb") ll <- fb(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=object at ntimes,homogeneous=TRUE)$logLike
+ if(method=="lystig") ll <- lystig(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=object at ntimes,homogeneous=TRUE)$logLike
if(method=="classification") {
ntimes <- ntimes(object)
- gamma <- fb(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=ntimes,stationary=TRUE)$gamma
+ gamma <- fb(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=ntimes,homogeneous=TRUE)$gamma
vstate <- t(apply(gamma,1,ind.max))
B <- object at dens
if(na.allow) B[is.na(B)] <- 1
Modified: pkg/depmixS4/R/lystig.R
===================================================================
--- pkg/depmixS4/R/lystig.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/lystig.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -4,7 +4,7 @@
# LYSTIG algoritme voor de loglikelihood, 23-3-2008
#
-lystig <- function(init,A,B,ntimes=NULL,stationary=TRUE,na.allow=TRUE) {
+lystig <- function(init,A,B,ntimes=NULL,homogeneous=TRUE,na.allow=TRUE) {
# Log likelihood computation according to Lystig & Hughes (2002). This
# is very similar to the Forward part of the Forward-Backward algorithm
@@ -43,7 +43,7 @@
sca[bt[case]] <- 1/sum(phi[bt[case],])
if(ntimes[case]>1) {
for(i in (bt[case]+1):et[case]) {
- if(stationary) phi[i,] <- (A[1,,]%*%phi[i-1,])*B[i,]
+ if(homogeneous) phi[i,] <- (A[1,,]%*%phi[i-1,])*B[i,]
else phi[i,] <- (A[i-1,,]%*%phi[i-1,])*B[i,]
phi[i,] <- sca[i-1]*phi[i,]
sca[i] <- 1/sum(phi[i,])
@@ -60,7 +60,7 @@
phi[1,] <- init[1,]*B[1,] # initialize
sca[1] <- 1/sum(phi[1,])
for(i in 2:nt) {
- if(stationary) phi[i,] <- (A[1,,]%*%phi[i-1,])*B[i,]
+ if(homogeneous) phi[i,] <- (A[1,,]%*%phi[i-1,])*B[i,]
else phi[i,] <- (A[i-1,,]%*%phi[i-1,])*B[i,]
phi[i,] <- sca[i-1]*phi[i,]
sca[i] <- 1/sum(phi[i,])
Modified: pkg/depmixS4/R/makeDepmix.R
===================================================================
--- pkg/depmixS4/R/makeDepmix.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/makeDepmix.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -42,8 +42,15 @@
# this function is probably not ever called by users
makeDepmix <-
-function(response, transition, prior, ntimes=NULL, stationary=TRUE, ...) {
-
+function(response, transition, prior, ntimes=NULL, homogeneous=TRUE, stationary=NULL, ...) {
+
+ if(!(is.null(stationary))) {
+ homogeneous <- stationary
+ warning("Argument 'stationary' has been replaced by argument 'homogeneous' in
+ version 1.3-0. In future versions argument 'stationary' will most likely be
+ used for other purposes.")
+ }
+
nstates <- length(response)
nresp <- length(response[[1]])
@@ -61,7 +68,7 @@
# make appropriate array for transition densities
nt <- sum(ntimes)
- if(stationary) trDens <- array(0,c(1,nstates,nstates))
+ if(homogeneous) trDens <- array(0,c(1,nstates,nstates))
else trDens <- array(0,c(nt,nstates,nstates))
# make appropriate array for response densities
@@ -82,7 +89,7 @@
if(!(dim(init)[1]==length(ntimes))) stop("Argument 'ntimes' does not agree with dimension of prior model.")
new("depmix",response=response,transition=transition,prior=prior,
- dens=dens,trDens=trDens,init=init,stationary=stationary,
+ dens=dens,trDens=trDens,init=init,homogeneous=homogeneous,
ntimes=ntimes,nstates=nstates,nresp=nresp,npars=npars)
}
Modified: pkg/depmixS4/R/makeTransModels.R
===================================================================
--- pkg/depmixS4/R/makeTransModels.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/makeTransModels.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -1,12 +1,12 @@
makeTransModels <-
-function(nstates,formula=~1,data=NULL,stationary,values=NULL, ...) {
+function(nstates,formula=~1,data=NULL,homogeneous,values=NULL, ...) {
# defaults that possibly need some work at some point
# FIX ME
base=1
prob=TRUE
- if(!stationary&is.null(data)) stop("non-stationary transition models needs data argument")
+ if(!homogeneous&is.null(data)) stop("non-homogeneous transition models needs data argument")
# starting values
tst <- FALSE
@@ -18,10 +18,10 @@
models <- list()
for(i in 1:nstates) {
if(tst) {
- if(stationary) models[[i]] <- transInit(formula,multinomial(link="identity"),data=data.frame(1),nstates=nstates,pstart=values[i,],prob=prob)
+ if(homogeneous) models[[i]] <- transInit(formula,multinomial(link="identity"),data=data.frame(1),nstates=nstates,pstart=values[i,],prob=prob)
else models[[i]] <- transInit(formula,multinomial(base=base),data=data,nstates=nstates,pstart=values[i,],prob=prob)
} else {
- if(stationary) models[[i]] <- transInit(formula,multinomial(link="identity"),data=data.frame(1),nstates=nstates,prob=FALSE)
+ if(homogeneous) models[[i]] <- transInit(formula,multinomial(link="identity"),data=data.frame(1),nstates=nstates,prob=FALSE)
else models[[i]] <- transInit(formula,multinomial(base=base),data=data,nstates=nstates,prob=FALSE)
}
}
Modified: pkg/depmixS4/R/transInit.R
===================================================================
--- pkg/depmixS4/R/transInit.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/transInit.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -186,7 +186,7 @@
return(states)
} else {
if(missing(times)) {
- # this is likely to be a stationary model...???
+ # this is likely to be a homogeneous model...???
pr <- predict(object)
} else {
pr <- predict(object)[times,]
Modified: pkg/depmixS4/R/viterbi.R
===================================================================
--- pkg/depmixS4/R/viterbi.R 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/R/viterbi.R 2013-09-13 14:25:31 UTC (rev 589)
@@ -31,7 +31,7 @@
if(object at ntimes[case]>1) {
for(tt in ((bt[case]+1):et[case])) {
for(j in 1:ns) {
- if(!object at stationary) {
+ if(!object at homogeneous) {
delta[tt,j] <- max(delta[tt-1,]*(A[tt,j,]))*B[tt,j]
k <- which.max(delta[tt-1,]*A[tt,j,])
} else {
Modified: pkg/depmixS4/inst/doc/depmixS4.Rnw
===================================================================
--- pkg/depmixS4/inst/doc/depmixS4.Rnw 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/inst/doc/depmixS4.Rnw 2013-09-13 14:25:31 UTC (rev 589)
@@ -1069,7 +1069,7 @@
the model:
<<>>=
mod <- makeDepmix(response = rModels, transition = transition,
- prior = inMod, stat = FALSE)
+ prior = inMod, homogeneous = FALSE)
fm <- fit(mod, verbose = FALSE, emc=em.control(rand=FALSE))
@
Modified: pkg/depmixS4/man/depmix-class.Rd
===================================================================
--- pkg/depmixS4/man/depmix-class.Rd 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/man/depmix-class.Rd 2013-09-13 14:25:31 UTC (rev 589)
@@ -38,7 +38,7 @@
\item{\code{init}:}{Array of dimension \code{length(ntimes)}*nstates with
the current predictions for the initial state probabilities.}
- \item{\code{stationary}:}{Logical indicating whether the transitions are
+ \item{\code{homogeneous}:}{Logical indicating whether the transitions are
time-dependent or not; for internal use.}
\item{\code{ntimes}:}{A vector containing the lengths of independent time
Modified: pkg/depmixS4/man/depmix.sim-class.Rd
===================================================================
--- pkg/depmixS4/man/depmix.sim-class.Rd 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/man/depmix.sim-class.Rd 2013-09-13 14:25:31 UTC (rev 589)
@@ -37,7 +37,7 @@
\item{\code{init}:}{Array of dimension \code{length(ntimes)}*nstates with
the current predictions for the initial state probabilities.}
- \item{\code{stationary}:}{Logical indicating whether the transitions are
+ \item{\code{homogeneous}:}{Logical indicating whether the transitions are
time-dependent or not; for internal use.}
\item{\code{ntimes}:}{A vector containing the lengths of independent time
Modified: pkg/depmixS4/man/makeDepmix.Rd
===================================================================
--- pkg/depmixS4/man/makeDepmix.Rd 2013-09-12 09:36:21 UTC (rev 588)
+++ pkg/depmixS4/man/makeDepmix.Rd 2013-09-13 14:25:31 UTC (rev 589)
@@ -20,8 +20,8 @@
\usage{
- makeDepmix(response, transition, prior, ntimes = NULL, stationary = TRUE,
- ...)
+ makeDepmix(response, transition, prior, ntimes = NULL, homogeneous = TRUE,
+ stationary = NULL, ...)
}
@@ -41,10 +41,17 @@
independent, time series. If not specified, the responses are
assumed to form a single time series.}
- \item{stationary}{Logical indicating whether the transition models
+ \item{homogeneous}{Logical indicating whether the transition models
include time-varying covariates; used internally to determine the
dimensions of certain arrays, notably \code{trDens}.}
+ \item{stationary}{This argument should no longer be used; if not NULL,
+ the value of stationary is copied to the homogeneous argument, with a
+ warning. In future versions this argument may be dropped or used for
+ different purposes, i.e., for specifying models in which the initial state
+ probabilities are constrained to be the stationary distribution of the
+ transition matrix.}
+
\item{...}{Not used currently.}
}
@@ -112,7 +119,7 @@
transition[[2]] <- transInit(~Pacc,nstates=2,data=speed)
inMod <- transInit(~1,ns=2,data=data.frame(rep(1,3)),family=multinomial("identity"))
-mod <- makeDepmix(response=rModels,transition=transition,prior=inMod,ntimes=c(168,134,137),stationary=FALSE)
+mod <- makeDepmix(response=rModels,transition=transition,prior=inMod,ntimes=c(168,134,137),homogeneous=FALSE)
set.seed(3)
fm1 <- fit(mod)
@@ -288,7 +295,7 @@
instart=c(0.5,0.5)
inMod <- transInit(~1,ns=2,ps=instart,data=data.frame(rep(1,3)))
-mod <- makeDepmix(response=rModels,transition=transition,prior=inMod,ntimes=c(168,134,137),stat=FALSE)
+mod <- makeDepmix(response=rModels,transition=transition,prior=inMod,ntimes=c(168,134,137),homogeneous=FALSE)
fm3 <- fit(mod,emc=em.control(rand=FALSE))
summary(fm3,compact=FALSE)
More information about the depmix-commits
mailing list