[Pomp-commits] r1058 - in pkg/pomp: . R tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 26 02:35:51 CET 2015
Author: kingaa
Date: 2015-01-26 02:35:51 +0100 (Mon, 26 Jan 2015)
New Revision: 1058
Modified:
pkg/pomp/DESCRIPTION
pkg/pomp/R/pomp-methods.R
pkg/pomp/tests/ou2-mif.Rout.save
Log:
- dimnames of arrays returned by 'states' and 'obs' will have names
Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION 2015-01-26 01:27:50 UTC (rev 1057)
+++ pkg/pomp/DESCRIPTION 2015-01-26 01:35:51 UTC (rev 1058)
@@ -1,8 +1,8 @@
Package: pomp
Type: Package
Title: Statistical Inference for Partially Observed Markov Processes
-Version: 0.58-6
-Date: 2015-01-22
+Version: 0.58-7
+Date: 2015-01-25
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")),
Modified: pkg/pomp/R/pomp-methods.R
===================================================================
--- pkg/pomp/R/pomp-methods.R 2015-01-26 01:27:50 UTC (rev 1057)
+++ pkg/pomp/R/pomp-methods.R 2015-01-26 01:35:51 UTC (rev 1058)
@@ -44,7 +44,9 @@
vars <- varnames
else if (!all(vars%in%varnames))
stop("some elements of ",sQuote("vars")," correspond to no observed variable")
- object at data[vars,,drop=FALSE]
+ y <- object at data[vars,,drop=FALSE]
+ dimnames(y) <- list(variable=rownames(y),time=time(object))
+ y
}
## a simple method to extract the data array
@@ -52,20 +54,20 @@
setMethod("data.array","pomp",obs.internal)
## a simple method to extract the array of states
-setMethod(
- "states",
- "pomp",
- function (object, vars, ...) {
- if (length(object at states)==0) {
- NULL
- } else {
- if (missing(vars))
- vars <- seq(length=nrow(object at states))
- object at states[vars,,drop=FALSE]
- }
- }
- )
+states.internal <- function (object, vars, ...) {
+ if (length(object at states)==0) {
+ NULL
+ } else {
+ if (missing(vars))
+ vars <- seq(length=nrow(object at states))
+ x <- object at states[vars,,drop=FALSE]
+ dimnames(x) <- list(variable=rownames(x),time=time(object))
+ x
+ }
+}
+setMethod("states","pomp",states.internal)
+
## a simple method to extract the vector of times
setMethod(
"time",
Modified: pkg/pomp/tests/ou2-mif.Rout.save
===================================================================
--- pkg/pomp/tests/ou2-mif.Rout.save 2015-01-26 01:27:50 UTC (rev 1057)
+++ pkg/pomp/tests/ou2-mif.Rout.save 2015-01-26 01:35:51 UTC (rev 1058)
@@ -26,12 +26,14 @@
> set.seed(64857673L)
>
> obs(window(ou2,end=20,start=15))
- [,1] [,2] [,3] [,4] [,5] [,6]
-y1 8.598190 2.199643 -1.134924 -2.564136 -4.915368 -4.338996
-y2 -4.903347 -10.251144 -10.362431 -8.168859 -7.220312 -2.310222
+ time
+variable 15 16 17 18 19 20
+ y1 8.598190 2.199643 -1.134924 -2.564136 -4.915368 -4.338996
+ y2 -4.903347 -10.251144 -10.362431 -8.168859 -7.220312 -2.310222
> obs(window(ou2,end=5),"y1")
- [,1] [,2] [,3] [,4] [,5]
-y1 -1.700816 0.2421701 3.767589 5.685888 3.774526
+ time
+variable 1 2 3 4 5
+ y1 -1.700816 0.2421701 3.767589 5.685888 3.774526
>
> fit1.pfilter <- pfilter(ou2,Np=1000)
> cat("coefficients at `truth'\n")
@@ -281,4 +283,4 @@
>
> proc.time()
user system elapsed
- 11.452 0.064 11.704
+ 14.827 0.050 14.879
More information about the pomp-commits
mailing list