[Pomp-commits] r266 - in pkg: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon May 31 20:06:29 CEST 2010
Author: kingaa
Date: 2010-05-31 20:06:29 +0200 (Mon, 31 May 2010)
New Revision: 266
Added:
pkg/R/mif-class.R
Removed:
pkg/R/aaa.R
Modified:
pkg/DESCRIPTION
pkg/NAMESPACE
pkg/R/dmeasure-pomp.R
pkg/R/dprocess-pomp.R
pkg/R/init.state-pomp.R
pkg/R/mif-methods.R
pkg/R/mif.R
pkg/R/particles-mif.R
pkg/R/pfilter.R
pkg/R/pomp-fun.R
pkg/R/pomp-methods.R
pkg/R/pomp.R
pkg/R/rmeasure-pomp.R
pkg/R/rprocess-pomp.R
pkg/R/skeleton-pomp.R
pkg/R/trajectory-pomp.R
Log:
- use the Collate option in package DESCRIPTION
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/DESCRIPTION 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,12 +1,21 @@
Package: pomp
Type: Package
Title: Statistical inference for partially observed Markov processes
-Version: 0.29-3
-Date: 2010-05-26
+Version: 0.29-4
+Date: 2010-05-31
Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall, Helen Wearing
Maintainer: Aaron A. King <kingaa at umich.edu>
+URL: http://pomp.r-forge.r-project.org
Description: Inference methods for partially-observed Markov processes
-Depends: R(>= 2.9.1), stats, methods, graphics, deSolve, subplex, mvtnorm
+Depends: R(>= 2.9.1), stats, methods, graphics, deSolve, subplex
+Imports: mvtnorm
License: GPL(>= 2)
LazyLoad: true
LazyData: false
+Collate: eulermultinom.R euler.R plugins.R slice.R sobol.R bsplines.R
+ pomp-fun.R pomp.R pomp-methods.R rmeasure-pomp.R rprocess-pomp.R
+ dmeasure-pomp.R dprocess-pomp.R simulate-pomp.R skeleton-pomp.R
+ trajectory-pomp.R plot-pomp.R init.state-pomp.R
+ pfilter.R trajmatch.R
+ mif-class.R particles-mif.R pfilter-mif.R mif.R mif-methods.R compare.mif.R
+ nlf-funcs.R nlf-guts.R nlf-lql.R nlf-objfun.R nlf.R
Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/NAMESPACE 2010-05-31 18:06:29 UTC (rev 266)
@@ -19,7 +19,7 @@
importFrom(graphics,plot)
importFrom(stats,simulate,time,coef,logLik)
-importFrom(mvtnorm,dmvnorm)
+importFrom(mvtnorm,dmvnorm,rmvnorm)
exportClasses('pomp','mif')
Deleted: pkg/R/aaa.R
===================================================================
--- pkg/R/aaa.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/aaa.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,141 +0,0 @@
-## all definitions of classes and generics should go in this file!
-## the partially-observed Markov process ("pomp") object
-
-## a class for functions that may be defined in R or using native routines
-setClass(
- 'pomp.fun',
- representation(
- R.fun = 'function',
- native.fun = 'character',
- PACKAGE = 'character',
- use = 'integer'
- )
- )
-
-## define the pomp class
-setClass(
- 'pomp',
- representation(
- data = 'array',
- times = 'numeric',
- t0 = 'numeric',
- rprocess = 'function',
- dprocess = 'function',
- dmeasure = 'pomp.fun',
- rmeasure = 'pomp.fun',
- skeleton.type = 'character',
- skeleton = 'pomp.fun',
- initializer = 'function',
- states = 'array',
- params = 'numeric',
- covar = 'matrix',
- tcovar = 'numeric',
- obsnames = 'character',
- statenames = 'character',
- paramnames = 'character',
- covarnames = 'character',
- PACKAGE = 'character',
- userdata = 'list',
- call = "call"
- )
- )
-
-## define the mif class
-setClass(
- 'mif',
- representation(
- ivps = 'character',
- pars = 'character',
- Nmif = 'integer',
- particles = 'function',
- alg.pars = 'list',
- random.walk.sd = 'numeric',
- pred.mean = 'matrix',
- pred.var = 'matrix',
- filter.mean = 'matrix',
- conv.rec = 'matrix',
- eff.sample.size = 'numeric',
- cond.loglik = 'numeric',
- loglik = 'numeric'
- ),
- contains='pomp'
- )
-
-## functions to extract or call the components of a "pomp" object
-data.array <- function (object, ...)
- stop("function ",sQuote("data.array")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('data.array')
-
-"time<-" <- function (object, ..., value)
- stop("function ",sQuote("time<-")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric("time<-")
-
-rprocess <- function (object, xstart, times, params, ...)
- stop("function ",sQuote("rprocess")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('rprocess')
-
-dprocess <- function (object, x, times, params, log = FALSE, ...)
- stop("function ",sQuote("dprocess")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('dprocess')
-
-rmeasure <- function (object, x, times, params, ...)
- stop("function ",sQuote("rmeasure")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('rmeasure')
-
-dmeasure <- function (object, y, x, times, params, log = FALSE, ...)
- stop("function ",sQuote("dmeasure")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('dmeasure')
-
-skeleton <- function (object, x, t, params, ...)
- stop("function ",sQuote("skeleton")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('skeleton')
-
-init.state <- function (object, params, t0, ...)
- stop("function ",sQuote("init.state")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('init.state')
-
-## particle filter
-pfilter <- function (object, ...)
- stop("function ",sQuote("pfilter")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('pfilter')
-
-## MIF algorithm functions
-mif <- function (object, ... )
- stop("function ",sQuote("mif")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('mif')
-
-particles <- function (object, ...)
- stop("function ",sQuote("particles")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('particles')
-
-pred.mean <- function (object, ...)
- stop("function ",sQuote("pred.mean")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('pred.mean')
-
-pred.var <- function (object, ...)
- stop("function ",sQuote("pred.var")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('pred.var')
-
-filter.mean <- function (object, ...)
- stop("function ",sQuote("filter.mean")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('filter.mean')
-
-conv.rec <- function (object, ...)
- stop("function ",sQuote("conv.rec")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('conv.rec')
-
-continue <- function (object, ... )
- stop("function ",sQuote("continue")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('continue')
-
-"coef<-" <- function (object, pars, ..., value)
- stop("function ",sQuote("coef<-")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric("coef<-")
-
-states <- function (object, ...)
- stop("function ",sQuote("states")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('states')
-
-trajectory <- function (object, params, times, ...)
- stop("function ",sQuote("trajectory")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('trajectory')
Modified: pkg/R/dmeasure-pomp.R
===================================================================
--- pkg/R/dmeasure-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/dmeasure-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+dmeasure <- function (object, y, x, times, params, log = FALSE, ...)
+ stop("function ",sQuote("dmeasure")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('dmeasure')
+
## evaluate the measurement model density function
setMethod(
'dmeasure',
Modified: pkg/R/dprocess-pomp.R
===================================================================
--- pkg/R/dprocess-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/dprocess-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+dprocess <- function (object, x, times, params, log = FALSE, ...)
+ stop("function ",sQuote("dprocess")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('dprocess')
+
## evaluate the process model density function
setMethod(
'dprocess',
Modified: pkg/R/init.state-pomp.R
===================================================================
--- pkg/R/init.state-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/init.state-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+init.state <- function (object, params, t0, ...)
+ stop("function ",sQuote("init.state")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('init.state')
+
## initialize the process model
setMethod(
'init.state',
Added: pkg/R/mif-class.R
===================================================================
--- pkg/R/mif-class.R (rev 0)
+++ pkg/R/mif-class.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -0,0 +1,20 @@
+## define the mif class
+setClass(
+ 'mif',
+ representation(
+ ivps = 'character',
+ pars = 'character',
+ Nmif = 'integer',
+ particles = 'function',
+ alg.pars = 'list',
+ random.walk.sd = 'numeric',
+ pred.mean = 'matrix',
+ pred.var = 'matrix',
+ filter.mean = 'matrix',
+ conv.rec = 'matrix',
+ eff.sample.size = 'numeric',
+ cond.loglik = 'numeric',
+ loglik = 'numeric'
+ ),
+ contains='pomp'
+ )
Modified: pkg/R/mif-methods.R
===================================================================
--- pkg/R/mif-methods.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/mif-methods.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,5 +1,21 @@
## this file contains short definitions of methods for the 'mif' class
+pred.mean <- function (object, ...)
+ stop("function ",sQuote("pred.mean")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('pred.mean')
+
+pred.var <- function (object, ...)
+ stop("function ",sQuote("pred.var")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('pred.var')
+
+filter.mean <- function (object, ...)
+ stop("function ",sQuote("filter.mean")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('filter.mean')
+
+conv.rec <- function (object, ...)
+ stop("function ",sQuote("conv.rec")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('conv.rec')
+
## extract the estimated log likelihood
setMethod('logLik','mif',function(object,...)object at loglik)
Modified: pkg/R/mif.R
===================================================================
--- pkg/R/mif.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/mif.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,5 @@
+## MIF algorithm functions
+
mif.cooling <- function (factor, n) {
alpha <- factor^(n-1)
list(alpha=alpha,gamma=alpha^2)
@@ -284,6 +286,14 @@
obj
}
+mif <- function (object, ... )
+ stop("function ",sQuote("mif")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('mif')
+
+continue <- function (object, ... )
+ stop("function ",sQuote("continue")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('continue')
+
setMethod(
"mif",
"pomp",
Modified: pkg/R/particles-mif.R
===================================================================
--- pkg/R/particles-mif.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/particles-mif.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,4 +1,9 @@
## draw a set of Np particles from the user-specified distribution
+
+particles <- function (object, ...)
+ stop("function ",sQuote("particles")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('particles')
+
setMethod(
"particles",
"mif",
Modified: pkg/R/pfilter.R
===================================================================
--- pkg/R/pfilter.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/pfilter.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,5 +1,10 @@
## particle filtering codes
+## generic particle filter
+pfilter <- function (object, ...)
+ stop("function ",sQuote("pfilter")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('pfilter')
+
## question: when pfilter.internal is called by mif, do we need to compute the prediction means and variances of the state variables each time, or only at the end?
## question: how much efficiency would be realized by eliminating the calls to 'apply' with something else?
Modified: pkg/R/pomp-fun.R
===================================================================
--- pkg/R/pomp-fun.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/pomp-fun.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,15 @@
+## a class for functions that may be defined in R or using native routines
+setClass(
+ 'pomp.fun',
+ representation(
+ R.fun = 'function',
+ native.fun = 'character',
+ PACKAGE = 'character',
+ use = 'integer'
+ )
+ )
+
+## constructor
pomp.fun <- function (f = NULL, PACKAGE, proto = NULL) {
if (missing(PACKAGE))
PACKAGE <- character(0)
Modified: pkg/R/pomp-methods.R
===================================================================
--- pkg/R/pomp-methods.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/pomp-methods.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,5 +1,22 @@
-## this file contains short methods definitions
+## this file contains some basic methods definitions
+## functions to extract or call the components of a "pomp" object
+data.array <- function (object, ...)
+ stop("function ",sQuote("data.array")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('data.array')
+
+"time<-" <- function (object, ..., value)
+ stop("function ",sQuote("time<-")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric("time<-")
+
+"coef<-" <- function (object, pars, ..., value)
+ stop("function ",sQuote("coef<-")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric("coef<-")
+
+states <- function (object, ...)
+ stop("function ",sQuote("states")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('states')
+
## 'coerce' method: allows for coercion of a "pomp" object to a data-frame
setAs(
from='pomp',
Modified: pkg/R/pomp.R
===================================================================
--- pkg/R/pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,4 +1,31 @@
-## constructor of the pomp class
+## define the pomp class
+setClass(
+ 'pomp',
+ representation(
+ data = 'array',
+ times = 'numeric',
+ t0 = 'numeric',
+ rprocess = 'function',
+ dprocess = 'function',
+ dmeasure = 'pomp.fun',
+ rmeasure = 'pomp.fun',
+ skeleton.type = 'character',
+ skeleton = 'pomp.fun',
+ initializer = 'function',
+ states = 'array',
+ params = 'numeric',
+ covar = 'matrix',
+ tcovar = 'numeric',
+ obsnames = 'character',
+ statenames = 'character',
+ paramnames = 'character',
+ covarnames = 'character',
+ PACKAGE = 'character',
+ userdata = 'list',
+ call = "call"
+ )
+ )
+
default.initializer <- function (params, t0, ...) {
ivpnames <- grep("\\.0$",names(params),val=TRUE)
if (length(ivpnames)<1)
@@ -8,6 +35,7 @@
x
}
+## constructor of the pomp class
pomp <- function (data, times, t0, ..., rprocess, dprocess,
rmeasure, dmeasure, measurement.model,
skeleton.map, skeleton.vectorfield, initializer, covar, tcovar,
Modified: pkg/R/rmeasure-pomp.R
===================================================================
--- pkg/R/rmeasure-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/rmeasure-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+rmeasure <- function (object, x, times, params, ...)
+ stop("function ",sQuote("rmeasure")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('rmeasure')
+
## simulate the measurement model
setMethod(
'rmeasure',
Modified: pkg/R/rprocess-pomp.R
===================================================================
--- pkg/R/rprocess-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/rprocess-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+rprocess <- function (object, xstart, times, params, ...)
+ stop("function ",sQuote("rprocess")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('rprocess')
+
## simulate the process model
setMethod(
'rprocess',
Modified: pkg/R/skeleton-pomp.R
===================================================================
--- pkg/R/skeleton-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/skeleton-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+skeleton <- function (object, x, t, params, ...)
+ stop("function ",sQuote("skeleton")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('skeleton')
+
## evaluate the measurement model density function
setMethod(
'skeleton',
Modified: pkg/R/trajectory-pomp.R
===================================================================
--- pkg/R/trajectory-pomp.R 2010-05-26 20:30:47 UTC (rev 265)
+++ pkg/R/trajectory-pomp.R 2010-05-31 18:06:29 UTC (rev 266)
@@ -1,3 +1,7 @@
+trajectory <- function (object, params, times, ...)
+ stop("function ",sQuote("trajectory")," is undefined for objects of class ",sQuote(class(object)))
+setGeneric('trajectory')
+
setMethod(
"trajectory",
"pomp",
More information about the pomp-commits
mailing list