[Depmix-commits] r456 - in pkg/depmixS4: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Mar 22 13:02:48 CET 2011


Author: ingmarvisser
Date: 2011-03-22 13:02:48 +0100 (Tue, 22 Mar 2011)
New Revision: 456

Removed:
   pkg/depmixS4/R/depmixAIC.R
   pkg/depmixS4/R/depmixBIC.R
   pkg/depmixS4/man/AIC.Rd
Modified:
   pkg/depmixS4/DESCRIPTION
   pkg/depmixS4/NAMESPACE
   pkg/depmixS4/R/allGenerics.R
   pkg/depmixS4/man/depmixS4-package.Rd
Log:
Using AIC/BIC/logLik/nobs generics from stats/stats4 rather than defining them anew (which gave clashes with other packages that did the same).

Modified: pkg/depmixS4/DESCRIPTION
===================================================================
--- pkg/depmixS4/DESCRIPTION	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/DESCRIPTION	2011-03-22 12:02:48 UTC (rev 456)
@@ -1,10 +1,10 @@
 Package: depmixS4
-Version: 1.0-2
-Date: 2011-02-15
+Version: 1.0-3
+Date: 2011-03-22
 Title: Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4
 Author: Ingmar Visser <i.visser at uva.nl>, Maarten Speekenbrink <m.speekenbrink at ucl.ac.uk>
 Maintainer: Ingmar Visser <i.visser at uva.nl>
-Depends: R (>= 2.11.1), stats, nnet, methods, MASS, Rsolnp
+Depends: R (>= 2.12.2), stats, nnet, methods, MASS, Rsolnp, stats4
 Suggests: Rdonlp2, gamlss, gamlss.dist
 Description: Fit latent (hidden) Markov models on mixed categorical and continuous (timeseries)
    data, otherwise known as dependent mixture models

Modified: pkg/depmixS4/NAMESPACE
===================================================================
--- pkg/depmixS4/NAMESPACE	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/NAMESPACE	2011-03-22 12:02:48 UTC (rev 456)
@@ -1,6 +1,8 @@
 import(methods)
 
-importFrom(stats, predict, simulate, AIC, logLik)
+importFrom(stats, predict, simulate)
+
+importFrom(stats4, AIC, BIC, logLik)
 
 export(	
 	makeDepmix,
@@ -14,7 +16,8 @@
 	em,
 	em.control,
 	viterbi,
-	mlogit
+	mlogit,
+	logLik
 )
 
 exportClasses(
@@ -30,9 +33,7 @@
 	transInit
 )
 
-exportMethods(
-	AIC,
-	BIC,
+exportMethods(
 	fit,
 	getConstraints,
 	npar,
@@ -51,10 +52,10 @@
 	transInit,
 	setpars,
 	getpars,
-	logLik,
 	predict,
 	dens,
 	show,
-	simulate,
-	summary
+	simulate,
+	summary,
+	logLik
 )

Modified: pkg/depmixS4/R/allGenerics.R
===================================================================
--- pkg/depmixS4/R/allGenerics.R	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/R/allGenerics.R	2011-03-22 12:02:48 UTC (rev 456)
@@ -9,6 +9,7 @@
 	require(MASS)
  	require(nnet)
 	require(Rsolnp)
+	require(stats4)	
 }
 
 .Last.lib <- function(libpath) {}
@@ -26,10 +27,10 @@
 setGeneric("transInit", function(formula, nstates, data = NULL, family = multinomial(),
                  pstart = NULL, fixed = NULL, prob=TRUE, ...) standardGeneric("transInit"))
 
+# extractors/set functions
+
 setGeneric("npar", function(object, ...) standardGeneric("npar"))
 
-setGeneric("nobs", function(object, ...) standardGeneric("nobs"))
-
 setGeneric("ntimes", function(object, ...) standardGeneric("ntimes"))
 
 setGeneric("nstates", function(object, ...) standardGeneric("nstates"))
@@ -38,43 +39,42 @@
 
 setGeneric("freepars", function(object, ...) standardGeneric("freepars"))
 
+setGeneric("getdf",function(object) standardGeneric("getdf"))
+
 setGeneric("nlin", function(object, ...) standardGeneric("nlin"))
 
-# setGeneric("getModel", function(object, ...) standardGeneric("getModel"))
+setGeneric("nobs", function(object, ...) standardGeneric("nobs"))
 
-# setGeneric("logLik", function(object, ...) standardGeneric("logLik"))
-
-setGeneric("fit", function(object, ...) standardGeneric("fit"))
-
 setGeneric("getConstraints", function(object, ...) standardGeneric("getConstraints"))
 
-setGeneric("posterior", function(object, ...) standardGeneric("posterior"))
+setGeneric("is.stationary", function(object,...) standardGeneric("is.stationary"))
 
-setGeneric("forwardbackward", function(object, ...) standardGeneric("forwardbackward"))
+setGeneric("setpars", function(object,values,which="pars",...) standardGeneric("setpars"))
 
-setGeneric("simulate", function(object,nsim=1,seed=NULL, ...) standardGeneric("simulate"))
+setGeneric("getpars", function(object,which="pars",...) standardGeneric("getpars"))
 
-setGeneric("predict", function(object, ...) standardGeneric("predict"))
 
-# setGeneric("AIC", function(object, ..., k=2) standardGeneric("AIC"))
+# functions 
+setGeneric("fit", function(object, ...) standardGeneric("fit"))
 
-setGeneric("BIC", function(object, ...) standardGeneric("BIC"))
+setGeneric("posterior", function(object, ...) standardGeneric("posterior"))
 
-setGeneric("getdf",function(object) standardGeneric("getdf"))
+setGeneric("forwardbackward", function(object, ...) standardGeneric("forwardbackward"))
 
-setGeneric("setpars", function(object,values,which="pars",...) standardGeneric("setpars"))
+setGeneric("simulate", function(object,nsim=1,seed=NULL, ...) standardGeneric("simulate"))
 
-setGeneric("getpars", function(object,which="pars",...) standardGeneric("getpars"))
-
 setGeneric("logDens",function(object,...) standardGeneric("logDens"))
 
 setGeneric("dens",function(object,...) standardGeneric("dens"))
 
-setGeneric("summary")
+setGeneric("predict", function(object, ...) standardGeneric("predict"))
 
-setGeneric("ntimes", function(object, ...) standardGeneric("ntimes"))
 
-setGeneric("nresp", function(object, ...) standardGeneric("nresp"))
+# redundant??
 
-setGeneric("is.stationary", function(object,...) standardGeneric("is.stationary"))
+# setGeneric("getModel", function(object, ...) standardGeneric("getModel"))
 
+# these are imported from stats4
+# setGeneric("logLik", function(object, ...) standardGeneric("logLik"))
+# setGeneric("AIC", function(object, ..., k=2) standardGeneric("AIC"))
+# setGeneric("BIC", function(object, ...) standardGeneric("BIC"))

Deleted: pkg/depmixS4/R/depmixAIC.R
===================================================================
--- pkg/depmixS4/R/depmixAIC.R	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/R/depmixAIC.R	2011-03-22 12:02:48 UTC (rev 456)
@@ -1,13 +0,0 @@
-# depends on logLik and freepars
-setMethod("AIC", signature(object="depmix"),
-	function(object, ..., k=2){
-		c(-2 * logLik(object) + freepars(object) * k)
-	}
-)
-
-# depends on logLik and freepars
-setMethod("AIC", signature(object="mix"),
-	function(object, ..., k=2){
-		c(-2 * logLik(object) + freepars(object) * k)
-	}
-)
\ No newline at end of file

Deleted: pkg/depmixS4/R/depmixBIC.R
===================================================================
--- pkg/depmixS4/R/depmixBIC.R	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/R/depmixBIC.R	2011-03-22 12:02:48 UTC (rev 456)
@@ -1,12 +0,0 @@
-# depends on logLik, freepars and nobs
-setMethod("BIC", signature(object="depmix"),
-	function(object, ...){
-		c(-2 * logLik(object) + freepars(object) * log(nobs(object)))
-	}
-)
-
-setMethod("BIC", signature(object="mix"),
-	function(object, ...){
-		c(-2 * logLik(object) + freepars(object) * log(nobs(object)))
-	}
-)
Deleted: pkg/depmixS4/man/AIC.Rd
===================================================================
--- pkg/depmixS4/man/AIC.Rd	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/man/AIC.Rd	2011-03-22 12:02:48 UTC (rev 456)
@@ -1,48 +0,0 @@
-\name{AIC}
-
-\alias{AIC}
-\alias{AIC,depmix-method}
-\alias{AIC,mix-method}
-
-\alias{BIC}
-\alias{BIC,depmix-method}
-\alias{BIC,mix-method}
-
-\title{Compute AIC and BIC for (dep-)mix objects}
-
-\description{
-	Compute AIC and BIC for \code{depmix} and \code{mix} objects.
-}
-
-\usage{
-	AIC(object, ..., k = 2)
-	BIC(object, ...)
-}
-
-\arguments{
-  \item{object}{A \code{depmix} or \code{mix} model.}
-  \item{\dots}{Not used currently.}
-  \item{k}{The penalty factor which defaults to 2.}
-}
-
-\value{
-	The value of the AIC or BIC respectively.
-}
-
-\details{
-	The \code{n} that is used in the BIC is \code{sum(ntimes(object))}, where
-	object is the model under consideration. 
-}
-
-\references{
-	H. Akaike. Information theory and an extension of the maximum likelihood 
-	principle. In B. N. Petrov and F. Csaki, editors, Second International
-	Symposium on Information Theory, p. 267-281. Budapest: Academiai Kiado, 1973.
-
-	G. Schwarz. Estimating the dimension of a model. Annals of Statistics, 
-	volume 6, p. 4761-464, 1978. 
-}
-
-\author{Ingmar Visser}
-
-\keyword{htest}

Modified: pkg/depmixS4/man/depmixS4-package.Rd
===================================================================
--- pkg/depmixS4/man/depmixS4-package.Rd	2011-03-22 10:31:02 UTC (rev 455)
+++ pkg/depmixS4/man/depmixS4-package.Rd	2011-03-22 12:02:48 UTC (rev 456)
@@ -34,8 +34,8 @@
 	\tabular{ll}{
 		Package: \tab depmixS4\cr
 		Type: \tab Package\cr
-		Version: \tab 1.0-0\cr
-		Date: \tab 2010-08-04\cr
+		Version: \tab 1.0-3\cr
+		Date: \tab 2011-03-22\cr
 		License: \tab GPL\cr
 	}
 



More information about the depmix-commits mailing list