[Pomp-commits] r1083 - in pkg/pomp: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Feb 22 20:38:41 CET 2015
Author: kingaa
Date: 2015-02-22 20:38:41 +0100 (Sun, 22 Feb 2015)
New Revision: 1083
Added:
pkg/pomp/R/proposals.R
pkg/pomp/man/proposals.Rd
Modified:
pkg/pomp/DESCRIPTION
pkg/pomp/NAMESPACE
Log:
- new MCMC proposal-function construction functions
Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION 2015-02-17 19:17:11 UTC (rev 1082)
+++ pkg/pomp/DESCRIPTION 2015-02-22 19:38:41 UTC (rev 1083)
@@ -1,8 +1,8 @@
Package: pomp
Type: Package
Title: Statistical Inference for Partially Observed Markov Processes
-Version: 0.59-1
-Date: 2015-02-14
+Version: 0.60-1
+Date: 2015-02-22
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")),
@@ -35,7 +35,7 @@
pfilter.R pfilter-methods.R minim.R traj-match.R
bsmc.R bsmc2.R
mif.R mif-methods.R
- pmcmc.R pmcmc-methods.R
+ proposals.R pmcmc.R pmcmc-methods.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
abc.R abc-methods.R
Modified: pkg/pomp/NAMESPACE
===================================================================
--- pkg/pomp/NAMESPACE 2015-02-17 19:17:11 UTC (rev 1082)
+++ pkg/pomp/NAMESPACE 2015-02-22 19:38:41 UTC (rev 1083)
@@ -85,6 +85,7 @@
onestep.sim,
onestep.dens,
gillespie.sim,
+ mvn.diag.rw,mvn.rw,
sobol,
sobolDesign,
sliceDesign,
Added: pkg/pomp/R/proposals.R
===================================================================
--- pkg/pomp/R/proposals.R (rev 0)
+++ pkg/pomp/R/proposals.R 2015-02-22 19:38:41 UTC (rev 1083)
@@ -0,0 +1,25 @@
+mvn.rw.proposal.fn <- function (rw.sd) {
+ parnm <- colnames(rw.sd)
+ n <- ncol(rw.sd)
+ if (is.null(parnm))
+ stop(sQuote("rw.sd")," must have names")
+ if (is.matrix(rw.sd)) {
+ if (nrow(rw.sd)!=ncol(rw.sd))
+ stop(sQuote("rw.sd")," must be a square matrix")
+ ch <- try (chol(rw.sd,pivot=TRUE))
+ if (inherits(ch,"try-error"))
+ stop("error in Choleski factorization of ",sQuote("rw.sd"))
+ oo <- order(attr(ch,"pivot"))
+ Q <- ch[,oo]
+ fn <- function (theta) {
+ theta[parnm] <- theta[parnm]+Q.rnorm(n=n,mean=0,sd=1)
+ theta
+ }
+ } else {
+ fn <- function (theta) {
+ theta[parnm] <- rnorm(n=n,mean=theta[parnm],sd=rw.sd)
+ theta
+ }
+ }
+ fn
+}
Added: pkg/pomp/man/proposals.Rd
===================================================================
--- pkg/pomp/man/proposals.Rd (rev 0)
+++ pkg/pomp/man/proposals.Rd 2015-02-22 19:38:41 UTC (rev 1083)
@@ -0,0 +1,27 @@
+\name{proposals}
+\alias{MCMC proposal functions}
+\alias{mvn.rw}
+\alias{mvn.diag.rw}
+\title{MCMC proposal functions}
+\description{
+ Construct proposal distributions for use with MCMC methods.
+}
+\usage{
+ mvn.diag.rw(rw.sd)
+ mvn.rw(rw.var)
+}
+\arguments{
+ \item{rw.sd}{
+ named numeric vector;
+ random-walk SDs for a multivariate normal random-walk proposal with diagonal variance-covariance matrix.
+ }
+ \item{rw.var}{
+ square numeric matrix with row- and column-names.
+ Specifies the variance-covariance matrix for a multivariate normal random-walk proposal distribution.
+ }
+}
+\value{
+ Functions taking a single argument.
+ Given a parameter vector, each returns a single draw from the corresponding proposal distribution.
+}
+\author{Aaron A. King \email{kingaa at umich dot edu}}
More information about the pomp-commits
mailing list