[Depmix-commits] r315 - trunk/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 19 13:30:59 CET 2010
Author: ingmarvisser
Date: 2010-01-19 13:30:59 +0100 (Tue, 19 Jan 2010)
New Revision: 315
Modified:
trunk/man/depmix-internal.Rd
trunk/man/depmix.fit.Rd
trunk/man/makeDepmix.Rd
Log:
Minor Rd issues solved.
Modified: trunk/man/depmix-internal.Rd
===================================================================
--- trunk/man/depmix-internal.Rd 2010-01-19 12:29:20 UTC (rev 314)
+++ trunk/man/depmix-internal.Rd 2010-01-19 12:30:59 UTC (rev 315)
@@ -6,7 +6,6 @@
\alias{logDens}
\alias{lystig}
-\alias{makeMix}
\alias{makePriorModel}
\alias{makeResponseModels}
\alias{makeTransModels}
@@ -36,7 +35,7 @@
\alias{fit,GLMresponse-method}
\alias{fit,BINOMresponse-method}
-\alias{fit,NORMresponse-method}w
+\alias{fit,NORMresponse-method}
\alias{fit,MULTINOMresponse-method}
\alias{fit,MVNresponse-method}
\alias{fit,transInit-method}
@@ -55,19 +54,23 @@
\alias{getpars,MVNresponse-method}
\alias{setpars,MVNresponse-method}
-
\alias{npar,response-method}
-\title{Depmix internal functions}
+\title{DepmixS4 internal functions}
\description{
+
Internal depmix functions, methods and classes.
+
}
\details{
+
These are not to be called by the user.
+
}
\author{Ingmar Visser}
\keyword{internal}
+
Modified: trunk/man/depmix.fit.Rd
===================================================================
--- trunk/man/depmix.fit.Rd 2010-01-19 12:29:20 UTC (rev 314)
+++ trunk/man/depmix.fit.Rd 2010-01-19 12:30:59 UTC (rev 315)
@@ -21,8 +21,10 @@
\code{fit} optimizes parameters of \code{\link{depmix}} or
\code{\link{mix}} models, optionally subject to general linear
- (in)equality constraints.}
+ (in)equality constraints.
+}
+
\usage{
\S4method{fit}{depmix}(object, fixed=NULL, equal=NULL, conrows=NULL,
Modified: trunk/man/makeDepmix.Rd
===================================================================
--- trunk/man/makeDepmix.Rd 2010-01-19 12:29:20 UTC (rev 314)
+++ trunk/man/makeDepmix.Rd 2010-01-19 12:30:59 UTC (rev 315)
@@ -1,9 +1,10 @@
-\name{depmix}
+\name{makeDepmix}
\docType{methods}
\alias{makeDepmix}
+\alias{makeMix}
\title{Dependent Mixture Model Specifiction: full control and adding response models}
@@ -130,21 +131,21 @@
# functions from the gamlss family of packages; see their help pages for
# interpretation of the mu, nu and sigma parameters that are fitted below
-require(gamlss)
-require(gamlss.dist)
-
-data(speed)
-rt <- speed$rt
-
-# define a response class which only contains the standard slots, no additional slots
+require(gamlss)
+require(gamlss.dist)
+
+data(speed)
+rt <- speed$rt
+
+# define a response class which only contains the standard slots, no additional slots
setClass("exgaus", contains="response")
-
-# define a generic for the method defining the response class
-setGeneric("exgaus", function(y, pstart = NULL, fixed = NULL, ...) standardGeneric("exgaus"))
+# define a generic for the method defining the response class
+setGeneric("exgaus", function(y, pstart = NULL, fixed = NULL, ...) standardGeneric("exgaus"))
+
# define the method that creates the response class
-
+
setMethod("exgaus",
signature(y="ANY"),
function(y,pstart=NULL,fixed=NULL, ...) {
@@ -160,8 +161,8 @@
parameters$nu <- log(pstart[3])
}
mod <- new("exgaus",parameters=parameters,fixed=fixed,x=x,y=y,npar=npar)
- mod
- }
+ mod
+ }
)
setMethod("show","exgaus",
@@ -221,15 +222,15 @@
function(object,w) {
if(missing(w)) w <- NULL
y <- object at y
- fit <- gamlss(y~1,weights=w,family=exGAUS(),
- control=gamlss.control(n.cyc=100,trace=FALSE),
- mu.start=object at parameters$mu,
- sigma.start=exp(object at parameters$sigma),
- nu.start=exp(object at parameters$nu))
- pars <- c(fit$mu.coefficients,fit$sigma.coefficients,fit$nu.coefficients)
- object <- setpars(object,pars)
- object
- }
+ fit <- gamlss(y~1,weights=w,family=exGAUS(),
+ control=gamlss.control(n.cyc=100,trace=FALSE),
+ mu.start=object at parameters$mu,
+ sigma.start=exp(object at parameters$sigma),
+ nu.start=exp(object at parameters$nu))
+ pars <- c(fit$mu.coefficients,fit$sigma.coefficients,fit$nu.coefficients)
+ object <- setpars(object,pars)
+ object
+ }
)
setMethod("predict","exgaus",
@@ -239,30 +240,30 @@
}
)
-rModels <- list(
- list(
- exgaus(rt,pstart=c(5,.1,.1)),
- GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(0.5,0.5))
- ),
- list(
- exgaus(rt,pstart=c(6,.1,.1)),
- GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(.1,.9))
- )
-)
-
-trstart=c(0.9,0.1,0.1,0.9)
-
-transition <- list()
-transition[[1]] <- transInit(~Pacc,nstates=2,data=speed,pstart=c(trstart[1:2],0,0))
-transition[[2]] <- transInit(~Pacc,nstates=2,data=speed,pstart=c(trstart[3:4],0,0))
-
-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=attr(speed,"ntimes"),stat=FALSE)
-
-logLik(mod)
-
+rModels <- list(
+ list(
+ exgaus(rt,pstart=c(5,.1,.1)),
+ GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(0.5,0.5))
+ ),
+ list(
+ exgaus(rt,pstart=c(6,.1,.1)),
+ GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(.1,.9))
+ )
+)
+
+trstart=c(0.9,0.1,0.1,0.9)
+
+transition <- list()
+transition[[1]] <- transInit(~Pacc,nstates=2,data=speed,pstart=c(trstart[1:2],0,0))
+transition[[2]] <- transInit(~Pacc,nstates=2,data=speed,pstart=c(trstart[3:4],0,0))
+
+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=attr(speed,"ntimes"),stat=FALSE)
+
+logLik(mod)
+
fm1 <- fit(mod)
summary(fm1)
More information about the depmix-commits
mailing list