[Pomp-commits] r917 - in pkg/pomp: . R inst/doc
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Apr 7 23:15:08 CEST 2014
Author: kingaa
Date: 2014-04-07 23:15:07 +0200 (Mon, 07 Apr 2014)
New Revision: 917
Removed:
pkg/pomp/R/mif-class.R
pkg/pomp/R/particles-mif.R
Modified:
pkg/pomp/DESCRIPTION
pkg/pomp/R/mif-methods.R
pkg/pomp/R/mif.R
pkg/pomp/inst/doc/manual.pdf
Log:
- consolidate some files
Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION 2014-04-01 19:48:43 UTC (rev 916)
+++ pkg/pomp/DESCRIPTION 2014-04-07 21:15:07 UTC (rev 917)
@@ -1,8 +1,8 @@
Package: pomp
Type: Package
Title: Statistical inference for partially observed Markov processes
-Version: 0.49-3
-Date: 2014-03-31
+Version: 0.49-4
+Date: 2014-04-07
Authors at R: c(person(given=c("Aaron","A."),family="King",
role=c("aut","cre"),email="kingaa at umich.edu"),
person(given=c("Edward","L."),family="Ionides",role=c("aut")),
@@ -32,7 +32,7 @@
dprior-pomp.R rprior-pomp.R
simulate-pomp.R trajectory-pomp.R plot-pomp.R
pfilter.R pfilter-methods.R minim.R traj-match.R bsmc.R
- mif-class.R particles-mif.R mif.R mif-methods.R compare-mif.R
+ mif.R mif-methods.R compare-mif.R
pmcmc.R pmcmc-methods.R compare-pmcmc.R
nlf-funcs.R nlf-guts.R nlf-objfun.R nlf.R
probe.R probe-match.R basic-probes.R spect.R spect-match.R
Deleted: pkg/pomp/R/mif-class.R
===================================================================
--- pkg/pomp/R/mif-class.R 2014-04-01 19:48:43 UTC (rev 916)
+++ pkg/pomp/R/mif-class.R 2014-04-07 21:15:07 UTC (rev 917)
@@ -1,19 +0,0 @@
-## define the mif class
-setClass(
- 'mif',
- contains='pfilterd.pomp',
- representation=representation(
- transform = "logical",
- ivps = 'character',
- pars = 'character',
- Nmif = 'integer',
- particles = 'function',
- var.factor='numeric',
- ic.lag='integer',
- cooling.type='character',
- cooling.fraction='numeric',
- method='character',
- random.walk.sd = 'numeric',
- conv.rec = 'matrix'
- )
- )
Modified: pkg/pomp/R/mif-methods.R
===================================================================
--- pkg/pomp/R/mif-methods.R 2014-04-01 19:48:43 UTC (rev 916)
+++ pkg/pomp/R/mif-methods.R 2014-04-07 21:15:07 UTC (rev 917)
@@ -1,5 +1,46 @@
## this file contains short definitions of methods for the 'mif' class
+## draw a set of Np particles from the user-specified distribution
+particles.internal <- function (object, Np = 1, center = coef(object), sd = 0, ...) {
+ if ((length(sd)==1) && (sd == 0)) {
+ sd <- rep(0,length(center))
+ names(sd) <- names(center)
+ }
+ if (is.null(names(center)) || is.null(names(sd)))
+ stop("particles error: ",sQuote("center")," and ",sQuote("sd")," must have names",call.=FALSE)
+ if (length(sd)!=length(center))
+ stop("particles error: ",sQuote("center")," and ",sQuote("sd")," must be of equal length",call.=FALSE)
+ x <- try(
+ do.call(
+ object at particles,
+ c(
+ list(Np=Np,center=center,sd=sd),
+ object at userdata
+ )
+ ),
+ silent=FALSE
+ )
+ if (inherits(x,'try-error'))
+ stop("particles error: error in user-specified ",sQuote("particles")," function",call.=FALSE)
+ if (
+ !is.matrix(x) ||
+ Np!=ncol(x) ||
+ is.null(rownames(x))
+ )
+ stop("particles error: user ",sQuote("particles")," function must return a matrix with Np columns and rownames",call.=FALSE)
+ x
+}
+
+setMethod(
+ "particles",
+ signature=signature(object="mif"),
+ definition=function (object, Np = 1, center = coef(object),
+ sd = 0, ...) {
+ particles.internal(object=object,Np=Np,center=center,sd=sd,...)
+ }
+ )
+
+
## extract the estimated log likelihood
setMethod('logLik','mif',function(object,...)object at loglik)
Modified: pkg/pomp/R/mif.R
===================================================================
--- pkg/pomp/R/mif.R 2014-04-01 19:48:43 UTC (rev 916)
+++ pkg/pomp/R/mif.R 2014-04-07 21:15:07 UTC (rev 917)
@@ -1,5 +1,26 @@
## MIF algorithm functions
+## define the mif class
+setClass(
+ 'mif',
+ contains='pfilterd.pomp',
+ representation=representation(
+ transform = "logical",
+ ivps = 'character',
+ pars = 'character',
+ Nmif = 'integer',
+ particles = 'function',
+ var.factor='numeric',
+ ic.lag='integer',
+ cooling.type='character',
+ cooling.fraction='numeric',
+ method='character',
+ random.walk.sd = 'numeric',
+ conv.rec = 'matrix'
+ )
+ )
+
+
default.pomp.particles.fun <- function (Np, center, sd, ...) {
matrix(
data=rnorm(
Deleted: pkg/pomp/R/particles-mif.R
===================================================================
--- pkg/pomp/R/particles-mif.R 2014-04-01 19:48:43 UTC (rev 916)
+++ pkg/pomp/R/particles-mif.R 2014-04-07 21:15:07 UTC (rev 917)
@@ -1,37 +0,0 @@
-## draw a set of Np particles from the user-specified distribution
-
-particles.internal <- function (object, Np = 1, center = coef(object), sd = 0, ...) {
- if ((length(sd)==1) && (sd == 0)) {
- sd <- rep(0,length(center))
- names(sd) <- names(center)
- }
- if (is.null(names(center)) || is.null(names(sd)))
- stop("particles error: ",sQuote("center")," and ",sQuote("sd")," must have names",call.=FALSE)
- if (length(sd)!=length(center))
- stop("particles error: ",sQuote("center")," and ",sQuote("sd")," must be of equal length",call.=FALSE)
- x <- try(
- do.call(
- object at particles,
- c(
- list(Np=Np,center=center,sd=sd),
- object at userdata
- )
- ),
- silent=FALSE
- )
- if (inherits(x,'try-error'))
- stop("particles error: error in user-specified ",sQuote("particles")," function",call.=FALSE)
- if (
- !is.matrix(x) ||
- Np!=ncol(x) ||
- is.null(rownames(x))
- )
- stop("particles error: user ",sQuote("particles")," function must return a matrix with Np columns and rownames",call.=FALSE)
- x
-}
-
-setMethod("particles",signature=signature(object="mif"),
- function (object, Np = 1, center = coef(object), sd = 0, ...) {
- particles.internal(object=object,Np=Np,center=center,sd=sd,...)
- }
- )
Modified: pkg/pomp/inst/doc/manual.pdf
===================================================================
(Binary files differ)
More information about the pomp-commits
mailing list