[Yuima-commits] r318 - in pkg/yuima: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 31 07:21:55 CEST 2014
Author: iacus
Date: 2014-07-31 07:21:55 +0200 (Thu, 31 Jul 2014)
New Revision: 318
Modified:
pkg/yuima/DESCRIPTION
pkg/yuima/NEWS
pkg/yuima/R/yuima.R
pkg/yuima/R/yuima.sampling.R
Log:
fixed setsampling
Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION 2014-07-07 02:19:11 UTC (rev 317)
+++ pkg/yuima/DESCRIPTION 2014-07-31 05:21:55 UTC (rev 318)
@@ -1,8 +1,8 @@
Package: yuima
Type: Package
Title: The YUIMA Project package for SDEs
-Version: 1.0.22
-Date: 2014-07-07
+Version: 1.0.24
+Date: 2014-07-31
Depends: methods, zoo, stats4, utils, expm
Suggests: cubature, mvtnorm
Author: YUIMA Project Team
Modified: pkg/yuima/NEWS
===================================================================
--- pkg/yuima/NEWS 2014-07-07 02:19:11 UTC (rev 317)
+++ pkg/yuima/NEWS 2014-07-31 05:21:55 UTC (rev 318)
@@ -20,3 +20,4 @@
2014/04/28: modified qmle, added carma, modified lasso
2014/05/04: modified show method, setYuima sets the sampling from the data if sampling is missing
2014/07/07: modified llag.R, llag.Rd, cce_functions.c; estimated cross-correlation functions are converted to values in [-1,1]
+2014/07/31: fixed setSampling and print methods
\ No newline at end of file
Modified: pkg/yuima/R/yuima.R
===================================================================
--- pkg/yuima/R/yuima.R 2014-07-07 02:19:11 UTC (rev 317)
+++ pkg/yuima/R/yuima.R 2014-07-31 05:21:55 UTC (rev 318)
@@ -360,10 +360,15 @@
t.max <- unlist(lapply(object at data@zoo.data, function(u) as.character(round(time(u)[which.max(time(u))],3))))
delta <- NULL
+ is.max.delta <- rep("", n.series)
+ have.max.delta <- FALSE
for(i in 1:n.series){
- tmp <- length(table(round(diff(time(object at data@zoo.data[[i]]),5))))
+ tmp <- length(table(round(diff(time(object at data@zoo.data[[i]])),5)))
if(tmp>1){
- tmp <- NULL
+ tmp <- max(diff(time(object at data@zoo.data[[i]])), na.rm=TRUE)
+ is.max.delta[i] <- "*"
+ have.max.delta <- TRUE
+ #tmp <- NULL
} else {
tmp <- diff(time(object at data@zoo.data[[i]]))[1]
}
@@ -377,6 +382,8 @@
cat(sprintf("\n\nNumber of zoo time series: %d\n", n.series))
tmp <- data.frame(length=n.length, time.min = t.min, time.max =t.max, delta=delta)
+ if(have.max.delta)
+ tmp <- data.frame(tmp, note=is.max.delta)
nm <- names(object at data@zoo.data)
if(is.null(nm)){
rownames(tmp) <- sprintf("Series %d",1:n.series)
@@ -384,6 +391,8 @@
rownames(tmp) <- nm
}
print(tmp)
+ if(have.max.delta)
+ cat("================\n* : maximal mesh")
}
})
Modified: pkg/yuima/R/yuima.sampling.R
===================================================================
--- pkg/yuima/R/yuima.sampling.R 2014-07-07 02:19:11 UTC (rev 317)
+++ pkg/yuima/R/yuima.sampling.R 2014-07-31 05:21:55 UTC (rev 318)
@@ -60,8 +60,9 @@
# grid is missing, but non random sampling
-
- nTerm <- 0
+
+
+ nTerm <- 0
if(!missing(Terminal)) nTerm <- length(Terminal)
nInit <- 0
if(!missing(Initial)) nInit <- length(Initial)
@@ -100,7 +101,7 @@
if(nInit>0 & nTerm>0 & nObs>0){
dims <- c(nInit, nTerm, nObs)
ndim <- dims[ which.max(dims) ]
- Initial <- rep(Initial, ndim)[1:ndim]
+ Initial <- rep(Initial, ndim)[1:ndim]
Terminal <- rep(Terminal, ndim)[1:ndim]
if( any(Terminal < Initial))
stop("\nYUIMA: 'Terminal' < 'Initial'\n")
@@ -111,6 +112,23 @@
grid[[i]] <- seq(Initial[i], Terminal[i], by=delta[i])
}
+# Initial + delta + Terminal ( ignored) => n
+ if(nInit>0 & nTerm>0 & nDelta>0){
+ dims <- c(nInit, nTerm, nDelta)
+ ndim <- dims[ which.max(dims) ]
+ delta <- rep(delta, ndim)[1:ndim]
+ Initial <- rep(Initial, ndim)[1:ndim]
+ Terminal <- rep(Terminal, ndim)[1:ndim]
+ if( any(Terminal < Initial))
+ stop("\nYUIMA: 'Terminal' < 'Initial'\n")
+ n <- (Terminal-Initial)/delta
+ n <- rep(n, ndim)[1:ndim]
+ yuima.warn("'n' (re)defined.")
+ for(i in 1:ndim)
+ grid[[i]] <- seq(Initial[i], Terminal[i], by=delta[i])
+ }
+
+
.Object at Terminal <- Terminal
.Object at Initial <- Initial
.Object at n <- n
@@ -120,7 +138,7 @@
.Object at regular <- TRUE
return(.Object)
- })
+})
setSampling <- function(Initial=0, Terminal=1, n=100, delta,
grid, random=FALSE, sdelta=as.numeric(NULL),
More information about the Yuima-commits
mailing list