[Pomp-commits] r413 - in pkg: . R inst/doc man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 8 12:54:34 CET 2010


Author: kingaa
Date: 2010-11-08 12:54:34 +0100 (Mon, 08 Nov 2010)
New Revision: 413

Removed:
   pkg/man/pmcmc-class.Rd
   pkg/man/probed-pomp-class.Rd
   pkg/man/spect-pomp-class.Rd
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/probe-match.R
   pkg/R/spect-match.R
   pkg/inst/doc/advanced_topics_in_pomp.pdf
   pkg/inst/doc/intro_to_pomp.pdf
   pkg/man/pfilter.Rd
   pkg/man/pmcmc.Rd
   pkg/man/probe.Rd
   pkg/man/spect.Rd
   pkg/man/traj-match.Rd
   pkg/tests/ricker-probe.R
   pkg/tests/ricker-probe.Rout.save
   pkg/tests/ricker-spect.R
   pkg/tests/ricker-spect.Rout.save
Log:

- arrange for all classes to be exported
- rearrange documentation for classes; now it's together with the constructors
- fix bug in 'spect.match' with eval.only=TRUE
- add slot in 'probe.matched.pomp' to make it parallel with 'spect.matched.pomp'


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/DESCRIPTION	2010-11-08 11:54:34 UTC (rev 413)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Statistical inference for partially observed Markov processes
 Version: 0.36-1
-Date: 2010-11-05
+Date: 2010-11-07
 Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall, Helen Wearing, 
 	Matthew J. Ferrari, Michael Lavine, Daniel C. Reuman
 Maintainer: Aaron A. King <kingaa at umich.edu>

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/NAMESPACE	2010-11-08 11:54:34 UTC (rev 413)
@@ -33,7 +33,13 @@
 importFrom(deSolve,lsoda)
 importFrom(subplex,subplex)
 
-exportClasses('pomp')
+exportClasses(
+              "pomp","pfilterd.pomp",
+              "mif","pmcmc",
+              "traj.matched.pomp",
+              "probed.pomp","probe.matched.pomp"
+              ,"spect.pomp","spect.matched.pomp"
+              )
 
 exportMethods(
               'plot','show','print','coerce',

Modified: pkg/R/probe-match.R
===================================================================
--- pkg/R/probe-match.R	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/R/probe-match.R	2010-11-08 11:54:34 UTC (rev 413)
@@ -2,10 +2,11 @@
          "probe.matched.pomp",
          contains="probed.pomp",
          representation=representation(
+           est="character",
            weights="numeric",
            fail.value="numeric",
+           value="numeric",
            evals="integer",
-           value="numeric",
            convergence="integer",
            msg="character"
            )
@@ -18,6 +19,7 @@
             c(
               summary(as(object,"probed.pomp")),
               list(
+                   est=object at est,
                    weights=object at weights,
                    value=object at value,
                    eval=object at evals,
@@ -103,8 +105,7 @@
   if (!is(object,"pomp"))
     stop(sQuote("object")," must be of class ",sQuote("pomp"))
 
-  if (missing(start))
-    start <- coef(object)
+  if (missing(start)) start <- coef(object)
 
   if (!eval.only&&(length(est)<1))
     stop("parameters to be estimated must be specified in ",sQuote("est"))
@@ -205,6 +206,7 @@
             nsim=nsim,
             seed=seed
             ),
+      est=as.character(est),
       weights=weights,
       fail.value=as.numeric(fail.value),
       value=val,

Modified: pkg/R/spect-match.R
===================================================================
--- pkg/R/spect-match.R	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/R/spect-match.R	2010-11-08 11:54:34 UTC (rev 413)
@@ -4,9 +4,9 @@
          representation=representation(
            est="character",
            fail.value="numeric",
+           weights="numeric",
+           value="numeric",
            evals="integer",
-           value="numeric",
-           weights="numeric",
            convergence="integer",
            msg="character"
            )
@@ -43,8 +43,6 @@
   freq <- data.spec$freq
   datval <- data.spec$spec
 
-  if (missing(weights)) weights <- 1
-
   ## estimate power spectra of simulations
   simvals <- compute.spect.sim(
                                object,
@@ -90,9 +88,23 @@
   if (!is(object,"pomp"))
     stop(sQuote("object")," must be of class ",sQuote("pomp"))
 
-  if (missing(vars))
-    vars <- rownames(object at data)
+  if (missing(start)) start <- coef(object)
+
+  if (!eval.only&&(length(est)<1))
+    stop("parameters to be estimated must be specified in ",sQuote("est"))
+  if (!is.character(est)|!all(est%in%names(start)))
+    stop(sQuote("est")," must refer to parameters named in ",sQuote("start"))
+  par.index <- which(names(start)%in%est)
+  
+  if (missing(vars)) vars <- rownames(object at data)
             
+  if (missing(nsim)) {
+    if (is(object,"spect.pomp"))
+      nsim <- nrow(object at simspec)
+    else
+      stop(sQuote("nsim")," must be supplied")
+  }
+
   if (missing(kernel.width)) {
     if (is(object,"spect.pomp")) {
       kernel.width <- object at kernel.width
@@ -110,7 +122,7 @@
     }
   }
 
-  if (missing(nsim)||(nsim<1))
+  if (nsim<1)
     stop(sQuote("nsim")," must be specified as a positive integer")
 
   if (missing(detrend)) {
@@ -134,7 +146,9 @@
 
   if (missing(weights)) weights <- 1
   if (is.numeric(weights)) {
-    if ((length(weights)!=1)&&(length(weights)!=length(ds$freq)))
+    if (length(weights)==1)
+      weights <- rep(weights,length(ds$freq))
+    if ((length(weights)!=length(ds$freq)))
       stop("if ",sQuote("weights")," is provided as a vector, it must have length ",length(ds$freq))
   } else if (is.function(weights)) {
     weights <- sapply(ds$freq,weights)
@@ -145,15 +159,8 @@
     stop(sQuote("weights")," should be nonnegative and finite")
   weights <- weights/mean(weights)
 
-  if (missing(start))
-    start <- coef(object)
+  fail.value <- as.numeric(fail.value)
 
-  if (!eval.only&&(length(est)<1))
-    stop("parameters to be estimated must be specified in ",sQuote("est"))
-  if (!is.character(est)|!all(est%in%names(start)))
-    stop(sQuote("est")," must refer to parameters named in ",sQuote("start"))
-  par.index <- which(names(start)%in%est)
-  
   params <- start
   guess <- params[par.index]
 
@@ -175,7 +182,7 @@
                   )
     conv <- NA
     evals <- as.integer(c(1,0))
-    msg <- paste("no optimization performed")
+    msg <- "no optimization performed"
   } else {
     if (method == 'subplex') {
       opt <- subplex::subplex(

Modified: pkg/inst/doc/advanced_topics_in_pomp.pdf
===================================================================
(Binary files differ)

Modified: pkg/inst/doc/intro_to_pomp.pdf
===================================================================
(Binary files differ)

Modified: pkg/man/pfilter.Rd
===================================================================
--- pkg/man/pfilter.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/pfilter.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -8,6 +8,7 @@
 \alias{logLik-pfilterd.pomp}
 \alias{$,pfilterd.pomp-method}
 \alias{$-pfilterd.pomp}
+\alias{pfilterd.pomp-class}
 \title{Particle filter}
 \description{
   Run a plain vanilla particle filter.
@@ -72,39 +73,35 @@
 }
 \value{
   An object of class \code{pfilterd.pomp}.
-  This class inherits from class \code{\link{pomp-class}} and contains the following additional slots:
-  \item{pred.mean}{
-    The matrix of prediction means.
-    The rows correspond to states and parameters (if appropriate), in that order, the columns to successive observations in the time series contained in \code{object}.
+  This class inherits from class \code{\link[=pomp-class]{pomp}} and contains the following additional slots:
+  \describe{
+    \item{pred.mean, pred.var, filter.mean}{
+      matrices of prediction means, variances, and filter means, respectively.
+      In each of these, the rows correspond to states and parameters (if appropriate), in that order, the columns to successive observations in the time series contained in \code{object}.
+    }
+    \item{eff.sample.size}{
+      numeric vector containing the effective number of particles at each time point.
+    }
+    \item{cond.loglik}{
+      numeric vector containing the conditional log likelihoods at each time point.
+    }
+    \item{states}{
+      if \code{saves.states=TRUE}, the array of state-vectors at each time point, for each particle.
+      An array with dimensions \code{nvars}-by-\code{Np}-by-\code{ntimes}.
+      In particular, \code{states[,i,t]} can be considered a sample from \eqn{f[X|y_{1:t}]}.
+    }
+    \item{seed}{
+      the state of the random number generator at the time \code{pfilter} was called.
+      If the argument \code{seed} was specified, this is a copy;
+      if not, this is the internal state of the random number generator at the time of call.
+    }
+    \item{Np, tol, nfail}{
+      the number of particles used, failure tolerance, and number of filtering failures, respectively.
+    }
+    \item{loglik}{
+      the estimated log-likelihood.
+    }
   }
-  \item{pred.var}{
-    The matrix of prediction variances, in the same format as \code{pred.mean}.
-  }
-  \item{filter.mean}{
-    The matrix of filtering means, in the same format as \code{pred.mean}.
-  }
-  \item{eff.sample.size}{
-    A vector containing the effective number of particles at each time point.
-  }
-  \item{cond.loglik}{
-    A vector containing the conditional log likelihoods at each time point.
-  }
-  \item{states}{
-    If \code{saves.states=TRUE}, the array of state-vectors at each time point, for each particle.
-    An array with dimensions \code{nvars}-by-\code{Np}-by-\code{ntimes}.
-    In particular, \code{states[,i,t]} can be considered a sample from \eqn{f[X|y_{1:t}]}.
-  }
-  \item{seed}{
-    The state of the random number generator at the time \code{pfilter} was called.
-    If the argument \code{seed} was specified, this is a copy;
-    if not, this is the internal state of the random number generator at the time of call.
-  }
-  \item{Np, tol, nfail}{
-    The number of particles used, failure tolerance, and number of filtering failures, respectively.
-  }
-  \item{loglik}{
-    The estimated log-likelihood.
-  }
   These can be accessed using the \code{$} operator as if the returned object were a list.
   In addition, \code{logLik} returns the log likelihood.
 }

Deleted: pkg/man/pmcmc-class.Rd
===================================================================
--- pkg/man/pmcmc-class.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/pmcmc-class.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -1,66 +0,0 @@
-\name{pmcmc-class}
-\docType{class}
-\keyword{internal}
-\alias{pmcmc-class}
-\title{The "pmcmc" class}
-\description{
-  The \code{pmcmc} class holds a fitted model and is created by a call to \code{\link{pmcmc}}.
-  See \code{\link{pmcmc}} for usage.
-}
-\section{Objects from the Class}{
-  Objects can be created by calls to the \code{\link{pmcmc}} method on a \code{\link{pomp}} or \code{pfilterd.pomp} object.
-  Such a call uses the Particle MCMC algorithm to fit the model parameters.
-}
-\section{Slots}{
-  A \code{pmcmc} object is derived from a \code{pfilterd.pomp} object and therefore has all the slots of such an object.
-  A full description of slots in a \code{pmcmc} object follows.
-  \describe{
-    \item{pars}{
-      A character vector containing the names of parameters to be estimated using PMCMC.
-    }
-    \item{Np}{
-      Number of particles to use in each filtering operation.
-    }
-    \item{Nmcmc}{
-      Number of PMCMC iterations that have been completed.
-    }
-    \item{dprior}{
-      A function of prototype \code{dprior(params,hyperparams,log)} that evaluates the prior density. This defaults to an improper uniform prior.
-    }
-    \item{hyperparams}{
-      A list passed as an argument to \code{dprior}.
-    }
-    \item{random.walk.sd}{
-      A named vector containing the random-walk variances used to parameterize a Gaussian random walk MCMC proposal.
-    }
-    \item{log.prior}{
-      A numeric value containing the log of the prior density evaluated at the parameter vector in the params slot.
-    }
-    \item{data, times, t0, rprocess, dprocess, dmeasure, rmeasure,
-      skeleton.type, skeleton, initializer, states, params,
-      statenames, paramnames, covarnames, tcovar, covar,
-      PACKAGE, userdata}{
-      Inherited from the \code{pomp} class.
-    }
-  }
-}
-\section{Extends}{
-  Class \code{pomp}, directly.
-  See \code{\link{pomp-class}}.
-}
-\section{Methods}{
-  See \code{\link{pmcmc}}, \link{pmcmc-methods}.
-}
-\references{
-  C. Andrieu, A. Doucet and R. Holenstein,
-  Particle Markov chain Monte Carlo methods, 
-  J. Roy. Stat. Soc B, to appear, 2010.
-
-  C. Andrieu and G.O. Roberts,
-  The pseudo-marginal approach for efficient computation,
-  Ann Stat 37:697-725, 2009.
-}
-\author{Edward L. Ionides \email{ionides at umich dot edu}, Aaron A. King \email{kingaa at umich dot edu}}
-\seealso{\code{\link{pmcmc}}, \link{pmcmc-methods}, \code{\link{pomp}}, \link{pomp-class}}
-\keyword{models}
-\keyword{ts}

Modified: pkg/man/pmcmc.Rd
===================================================================
--- pkg/man/pmcmc.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/pmcmc.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -9,6 +9,7 @@
 \alias{pmcmc-pomp}
 \alias{continue,pmcmc-method}
 \alias{continue-pmcmc}
+\alias{pmcmc-class}
 \title{The PMCMC algorithm}
 \description{
   The Particle MCMC algorithm for estimating the parameters of a partially-observed Markov process.
@@ -77,6 +78,21 @@
     These are currently ignored.
   }
 }
+\value{
+  An object of class \code{pmcmc}.
+  This class inherits from class \code{\link[=pfilterd.pomp-class]{pfilterd.pomp}} and contains the following additional slots:
+  \describe{
+    \item{pars, Nmcmc, dprior, hyperparams}{
+      These slots hold the values of the corresponding arguments of the call to \code{pmcmc}.
+    }
+    \item{random.walk.sd}{
+      a named numeric vector containing the random-walk variances used to parameterize a Gaussian random walk MCMC proposal.
+    }
+    \item{log.prior}{
+      a numeric value containing the log of the prior density evaluated at the parameter vector in the params slot.
+    }
+  }
+}
 \section{Re-running PMCMC Iterations}{
   To re-run a sequence of PMCMC iterations, one can use the \code{pmcmc} method on a \code{pmcmc} object.
   By default, the same parameters used for the original PMCMC run are re-used (except for \code{tol}, \code{max.fail}, and \code{verbose}, the defaults of which are shown above).

Modified: pkg/man/probe.Rd
===================================================================
--- pkg/man/probe.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/probe.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -9,6 +9,8 @@
 \alias{probe.match,probed.pomp-method}
 \alias{probe.match-pomp}
 \alias{probe.match-probed.pomp}
+\alias{probed.pomp-class}
+\alias{probe.matched.pomp-class}
 \title{Probe a partially-observed Markov process.}
 \description{
   \code{probe} applies one or more \dQuote{probes} to time series data and model simulations and compares the results.
@@ -80,14 +82,37 @@
 \details{
   A call to \code{probe} results in the evaluation of the probe(s) in \code{probes} on the data.
   Additionally, \code{nsim} simulated data sets are generated (via a call to \code{\link[=simulate-pomp]{simulate}}) and the probe(s) are applied to each of these.
-  The results of the probe computations on real and simulated data are stored in an object of class \code{\link[=probed.pomp-class]{probed.pomp}}.
+  The results of the probe computations on real and simulated data are stored in an object of class \code{probed.pomp}.
 
   A call to \code{probe.match} results in an attempt to optimize the agreement between model and data, as measured by the specified probes, over the parameters named in \code{est}.
   The results, including coefficients of the fitted model and values of the probes for data and fitted-model simulations, are stored in an object of class \code{\link[=probe.matched.pomp-class]{probe.matched.pomp}}.
 }
 \value{
-  \code{probe} returns an object of class \code{\link[=probed.pomp-class]{probed.pomp}}.
-  \code{probe.match} returns an object of class \code{\link[=probe.matched.pomp-class]{probe.matched.pomp}}.
+  \code{probe} returns an object of class \code{probed.pomp}.
+  \code{probed.pomp} is derived from the \code{\link[=pomp-class]{pomp}} class and therefore have all the slots of \code{pomp}.
+  In addition, a \code{probed.pomp} class has the following slots:
+  \describe{
+    \item{probes}{list of the probes applied.}
+    \item{datvals, simvals}{values of each of the probes applied to the real and simulated data, respectively.}
+    \item{quantiles}{fraction of simulations with probe values less than the value of the probe of the data.}
+    \item{pvals}{two-sided p-values: fraction of the \code{simvals} that deviate more extremely from the mean of the \code{simvals} than does \code{datavals}.}
+    \item{synth.loglik}{the log synthetic likelihood (Wood 2010).  This is the likelihood assuming that the probes are multivariate-normally distributed.}
+  }
+
+  \code{probe.match} returns an object of class \code{probe.matched.pomp}, which is derived from class \code{probed.pomp}.
+  \code{probe.matched.pomp} objects therefore have all the slots above plus the following:
+  \describe{
+    \item{est, weights, fail.value}{values of the corresponding arguments in the call to \code{spect.match}.}
+    \item{value}{value of the objective function.}
+    \item{evals}{
+      number of function and gradient evaluations by the optimizer.
+      See \code{\link{optim}}.
+    }
+    \item{convergence, msg}{
+      Convergence code and message from the optimizer.
+      See \code{\link{optim}}.
+    }
+  }
 }
 \references{
   B. E. Kendall, C. J. Briggs, W. M. Murdoch, P. Turchin, S. P. Ellner, E. McCauley, R. M. Nisbet, S. N. Wood

Deleted: pkg/man/probed-pomp-class.Rd
===================================================================
--- pkg/man/probed-pomp-class.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/probed-pomp-class.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -1,67 +0,0 @@
-\name{probed.pomp-class}
-\docType{class}
-\alias{probed.pomp-class}
-\alias{probe.matched.pomp-class}
-\keyword{internal}
-\title{The "probed.pomp" and "probe.matched.pomp" classes}
-\description{
-  The \code{probed.pomp} class holds a \code{\link{pomp}} object together with a list of \dQuote{probes} and the results of applying them to the real and model-simulated data.
-  It is created by a call to \code{\link{probe}}.
-  See \code{\link{probe}} for usage.
-}
-\section{Objects from the Class}{
-  Objects can be created by calls to the \code{\link{probe}} method on a \code{\link{pomp}} object.
-}
-\section{Slots}{
-  The \code{probed.pomp} and \code{probe.matched.pomp} classes are derived from the \code{pomp} class and therefore have all the slots of \code{pomp}:
-  see \code{\link{pomp-class}} for details.
-  A full description of slots in a \code{probed.pomp} or \code{probe.matched.pomp} object follows.
-  \describe{
-    \item{probes}{list of the probes applied.}
-    \item{datvals, simvals}{values of each of the probes applied to the real and simulated data, respectively.}
-    \item{quantiles}{fraction of simulations with probe values less than the value of the probe of the data.}
-    \item{pvals}{two-sided p-values: fraction of the \code{simvals} that deviate more extremely from the mean of the \code{simvals} than does \code{datavals}.}
-    \item{synth.loglik}{the log synthetic likelihood (Wood 2010).  This is the likelihood assuming that the probes are multivariate-normally distributed.}
-    \item{weights}{relative weights applied to the discrepancies in computing the probe-matching objective function.}
-    \item{fail.value}{value to use to replace non-finite values of the objective function.}
-    \item{evals}{
-      number of function and gradient evaluations by the optimizer.
-      See \code{\link{optim}}.
-    }
-    \item{value}{Value of the objective function.}
-    \item{convergence, msg}{
-      Convergence code and message from the optimizer.
-      See \code{\link{optim}}.
-    }
-    \item{data, times, t0, rprocess, dprocess, dmeasure, rmeasure,
-      skeleton.type, skeleton, initializer, states, params,
-      statenames, paramnames, covarnames, tcovar, covar,
-      PACKAGE, userdata}{
-      Inherited from the \code{pomp} class.
-    }
-  }
-}
-\section{Extends}{
-  Class \code{pomp}, directly.
-  See \code{\link{pomp-class}}.
-}
-\section{Methods}{
-  See \code{\link{probe}}, \code{\link[=summary-probed.pomp]{summary}}, \code{\link[=plot-probed.pomp]{plot}}.
-}
-\references{
-  B. E. Kendall, C. J. Briggs, W. M. Murdoch, P. Turchin, S. P. Ellner, E. McCauley, R. M. Nisbet, S. N. Wood
-  Why do populations cycle? A synthesis of statistical and mechanistic modeling approaches,
-  Ecology, 80:1789--1805, 1999.
-
-  S. N. Wood
-  Statistical inference for noisy nonlinear ecological dynamic systems,
-  Nature, 466: 1102--1104, 2010.
-}
-\author{
-  Daniel C. Reuman \email{d.reuman at imperial dot ac dot uk}
-  
-  Aaron A. King \email{kingaa at umich dot edu}
-}
-\seealso{\code{\link{probe}}, \link{probed.pomp-methods}, \code{\link{pomp}}, \link{pomp-class}}
-\keyword{models}
-\keyword{ts}

Deleted: pkg/man/spect-pomp-class.Rd
===================================================================
--- pkg/man/spect-pomp-class.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/spect-pomp-class.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -1,73 +0,0 @@
-\name{spect.pomp-class}
-\docType{class}
-\alias{spect.pomp-class}
-\alias{spect.matched.pomp-class}
-\keyword{internal}
-\title{The "spect.pomp" and "spect.matched.pomp" classes}
-\description{
-  The \code{spect.pomp} class holds a \code{\link{pomp}} object together with power spectrum estimates of the data and of some number of model simulations.
-  It is created by a call to \code{\link{spect}}.
-  See \code{\link{spect}} for usage.
-}
-\section{Objects from the Class}{
-  Objects can be created by calls to the \code{\link{spect}} method or to the \code{\link{spect.match}} function on a \code{\link{pomp}} object.
-}
-\section{Slots}{
-  The \code{spect.pomp} and \code{spect.matched.pomp} classes are derived from the \code{pomp} class and therefore have all the slots of \code{pomp}:
-  see \code{\link{pomp-class}} for details.
-  A full description of slots in a \code{spect.pomp} or \code{spect.matched.pomp} object follows.
-  \describe{
-    \item{seed}{the seed of the RNG used.}
-    \item{kernel.width}{width parameter of the smoothing kernel used.}
-    \item{transform}{transformation function used.}
-    \item{detrend}{detrending option used.}
-    \item{fail.value}{value used to replace non-finite values of the objective function.}
-    \item{freq}{numeric vector of the frequencies at which the power spectrum is estimated.}
-    \item{datspec, simspec}{estimated power spectra for data and simulations, respectively.}
-    \item{pvals}{
-      one-sided p-values:
-      fraction of the simulated spectra that differ more from the mean simulated spectrum than does the data.
-      The metric used is \eqn{L^2}{L2} distance.
-    }
-    \item{evals}{
-      number of function and gradient evaluations by the optimizer.
-      See \code{\link{optim}}.
-    }
-    \item{value}{Value of the objective function.}
-    \item{convergence, msg}{
-      Convergence code and message from the optimizer.
-      See \code{\link{optim}}.
-    }
-    \item{data, times, t0, rprocess, dprocess, dmeasure, rmeasure,
-      skeleton.type, skeleton, initializer, states, params,
-      statenames, paramnames, covarnames, tcovar, covar,
-      obsnames, statenames, paramnames, covarnames, PACKAGE,
-      userdata, call}{
-      Inherited from the \code{pomp} class.
-    }
-  }
-}
-\section{Extends}{
-  Class \code{pomp}, directly.
-  See \code{\link{pomp-class}}.
-}
-\section{Methods}{
-  \describe{
-    \item{plot}{
-      plots the power spectrum of the data and a representation of the distribution of the simulated power spectra.
-    }
-  }
-}
-\author{
-  Daniel C. Reuman \email{d.reuman at imperial dot ac dot uk}
-  
-  Aaron A. King \email{kingaa at umich dot edu}
-}
-\seealso{
-  \code{\link{spect}},
-  \code{\link{spect.match}},
-  \code{\link{pomp}},
-  \link{pomp-class}
-}
-\keyword{models}
-\keyword{ts}

Modified: pkg/man/spect.Rd
===================================================================
--- pkg/man/spect.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/spect.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -9,6 +9,8 @@
 \alias{spect.match-pomp}
 \alias{spect.match,spect.pomp-method}
 \alias{spect.match-spect.pomp}
+\alias{spect.pomp-class}
+\alias{spect.matched.pomp-class}
 \title{Power spectrum computation for partially-observed Markov processes.}
 \description{
   \code{spect} estimates the power spectrum of time series data and model simulations and compares the results.
@@ -105,8 +107,35 @@
   The results, including coefficients of the fitted model and power spectra of fitted model and data, are stored in an object of class \code{\link[=spect.matched.pomp-class]{spect.matched.pomp}}.
 }
 \value{
-  \code{spect} returns an object of class \code{\link[=spect.pomp-class]{spect.pomp}}.
-  \code{spect.match} returns an object of class \code{\link[=spect.matched.pomp-class]{spect.matched.pomp}}.
+  \code{spect} returns an object of class \code{spect.pomp}, which is derived from class \code{\link[=pomp-class]{pomp}} and therefore has all the slots of that class.
+  In addition, \code{spect.pomp} objects have the following slots:
+  \describe{
+    \item{kernel.width}{width parameter of the smoothing kernel used.}
+    \item{transform}{transformation function used.}
+    \item{freq}{numeric vector of the frequencies at which the power spectrum is estimated.}
+    \item{datspec, simspec}{estimated power spectra for data and simulations, respectively.}
+    \item{pvals}{
+      one-sided p-values:
+      fraction of the simulated spectra that differ more from the mean simulated spectrum than does the data.
+      The metric used is \eqn{L^2}{L2} distance.
+    }
+    \item{detrend}{detrending option used.}
+  }
+  
+  \code{spect.match} returns an object of class \code{spect.matched.pomp}, which is derived from class \code{{spect.pomp}} and therefore has all the slots of that class.
+  In addition, \code{spect.matched.pomp} objects have the following slots:
+  \describe{
+    \item{est, weights, fail.value}{values of the corresponding arguments in the call to \code{spect.match}.}
+    \item{evals}{
+      number of function and gradient evaluations by the optimizer.
+      See \code{\link{optim}}.
+    }
+    \item{value}{Value of the objective function.}
+    \item{convergence, msg}{
+      Convergence code and message from the optimizer.
+      See \code{\link{optim}}.
+    }
+  }  
 }
 \references{
   D.C. Reuman, R.A. Desharnais, R.F. Costantino, O. Ahmad, J.E. Cohen (2006)
@@ -156,7 +185,3 @@
 }
 \keyword{models}
 \keyword{ts}
-
-
-
-

Modified: pkg/man/traj-match.Rd
===================================================================
--- pkg/man/traj-match.Rd	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/man/traj-match.Rd	2010-11-08 11:54:34 UTC (rev 413)
@@ -6,6 +6,7 @@
 \alias{$-traj.matched.pomp}
 \alias{summary,traj.matched.pomp-method}
 \alias{summary-traj.matched.pomp}
+\alias{traj.matched.pomp-class}
 \title{Trajectory matching}
 \description{
   Match trajectories to data.
@@ -39,6 +40,19 @@
 }
 \value{
   An object of class \code{traj.matched.pomp}.
+  This class inherits from class \code{\link[=pomp-class]{pomp}} and contains the following additional slots:
+  \describe{
+    \item{evals}{
+      number of function and gradient evaluations by the optimizer.
+      See \code{\link{optim}}.
+    }
+    \item{value}{Value of the objective function.}
+    \item{convergence, msg}{
+      Convergence code and message from the optimizer.
+      See \code{\link{optim}}.
+    }
+  }
+
   Available methods for objects of this type include \code{summary} and \code{logLik}.
   The other slots of this object can be accessed via the \code{$} operator.
 }

Modified: pkg/tests/ricker-probe.R
===================================================================
--- pkg/tests/ricker-probe.R	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/tests/ricker-probe.R	2010-11-08 11:54:34 UTC (rev 413)
@@ -84,6 +84,10 @@
 summary(pb)
 plot(pb)
 
+pbm <- probe.match(pb,eval.only=TRUE)
+plot(pbm)
+summary(pbm)
+
 coef(po) <- c(log.r=log(10),log.sigma=log(0.3),log.phi=log(20),N.0=5,e.0=0)
 
 pb <- probe(

Modified: pkg/tests/ricker-probe.Rout.save
===================================================================
--- pkg/tests/ricker-probe.Rout.save	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/tests/ricker-probe.Rout.save	2010-11-08 11:54:34 UTC (rev 413)
@@ -215,6 +215,48 @@
 
 > plot(pb)
 > 
+> pbm <- probe.match(pb,eval.only=TRUE)
+> plot(pbm)
+> summary(pbm)
+$coef
+    log.r log.sigma   log.phi       N.0       e.0 
+ 3.800000 -1.203973  2.302585  7.000000  0.000000 
+
+$nsim
+[1] 1000
+
+$quantiles
+ marg.1  marg.2  marg.3 acf.0.y acf.1.y acf.3.y acf.5.y    mean 
+  0.857   0.281   0.276   0.648   0.035   0.899   0.708   0.830 
+
+$pvals
+    marg.1     marg.2     marg.3    acf.0.y    acf.1.y    acf.3.y    acf.5.y 
+0.28771229 0.56343656 0.55344655 0.70529471 0.07192807 0.20379620 0.58541459 
+      mean 
+0.34165834 
+
+$synth.loglik
+[1] -14.77430
+
+$est
+character(0)
+
+$weights
+[1] 1
+
+$value
+[1] 15.31774
+
+$eval
+[1] 1 0
+
+$convergence
+[1] NA
+
+$msg
+[1] "no optimization performed"
+
+> 
 > coef(po) <- c(log.r=log(10),log.sigma=log(0.3),log.phi=log(20),N.0=5,e.0=0)
 > 
 > pb <- probe(
@@ -266,7 +308,7 @@
 +                               )
 +             )
    user  system elapsed 
- 12.860   0.031  12.893 
+ 13.482   0.016  13.516 
 > plot(pm)
 > 
 > cbind(truth=coef(ricker),est=coef(pm),guess=coef(po))
@@ -325,7 +367,7 @@
 +                               )
 +             )
    user  system elapsed 
-  9.608   0.009   9.618 
+ 10.165   0.030  10.208 
 > plot(pm)
 > plot(as(pm,"pomp"),variables="y")
 > plot(simulate(pm),variables="y")
@@ -352,7 +394,7 @@
 +             )
 > pb at datvals
    marg.1    marg.2    marg.3 
-24.306961 -4.195941 -3.990929 
+24.879460 -5.950185 -2.211594 
 > summary(pb)
 $coef
     log.r log.sigma   log.phi       N.0       e.0 
@@ -363,14 +405,14 @@
 
 $quantiles
 marg.1 marg.2 marg.3 
- 1.000  0.000  0.067 
+  1.00   0.00   0.32 
 
 $pvals
      marg.1      marg.2      marg.3 
-0.001998002 0.001998002 0.135864136 
+0.001998002 0.001998002 0.641358641 
 
 $synth.loglik
-[1] -65.7886
+[1] -56.62876
 
 > plot(pb)
 > 

Modified: pkg/tests/ricker-spect.R
===================================================================
--- pkg/tests/ricker-spect.R	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/tests/ricker-spect.R	2010-11-08 11:54:34 UTC (rev 413)
@@ -1,9 +1,9 @@
 library(pomp)
 
+pdf(file="ricker-spect.pdf")
+
 data(ricker)
 
-pdf(file="ricker-spect.pdf")
-
 set.seed(6457673L)
 
 sp <- spect(
@@ -15,6 +15,10 @@
 plot(sp)
 summary(sp)
 
+spp <- spect.match(sp,eval.only=TRUE)
+plot(spp)
+summary(spp)
+
 po <- ricker
 coef(po,"log.r") <- log(5)
 sp <- spect(

Modified: pkg/tests/ricker-spect.Rout.save
===================================================================
--- pkg/tests/ricker-spect.Rout.save	2010-11-07 17:21:02 UTC (rev 412)
+++ pkg/tests/ricker-spect.Rout.save	2010-11-08 11:54:34 UTC (rev 413)
@@ -17,10 +17,10 @@
 
 > library(pomp)
 > 
+> pdf(file="ricker-spect.pdf")
+> 
 > data(ricker)
 > 
-> pdf(file="ricker-spect.pdf")
-> 
 > set.seed(6457673L)
 > 
 > sp <- spect(
@@ -43,6 +43,36 @@
 0.6113886 0.6113886 
 
 > 
+> spp <- spect.match(sp,eval.only=TRUE)
+> plot(spp)
+> summary(spp)
+$coef
+    log.r log.sigma   log.phi       N.0       e.0 
+ 3.800000 -1.203973  2.302585  7.000000  0.000000 
+
+$nsim
+[1] 1000
+
+$pvals
+        y       all 
+0.6423576 0.6423576 
+
+$est
+character(0)
+
+$value
+[1] 3.242017
+
+$eval
+[1] 1 0
+
+$convergence
+[1] NA
+
+$msg
+[1] "no optimization performed"
+
+> 
 > po <- ricker
 > coef(po,"log.r") <- log(5)
 > sp <- spect(



More information about the pomp-commits mailing list