[Yuima-commits] r76 - in pkg/yuima: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 10 00:54:50 CEST 2010
Author: iacus
Date: 2010-06-10 00:54:49 +0200 (Thu, 10 Jun 2010)
New Revision: 76
Modified:
pkg/yuima/DESCRIPTION
pkg/yuima/R/asymptotic_term.R
pkg/yuima/R/simulate.R
pkg/yuima/R/yuima.sampling.R
pkg/yuima/man/limiting.gamma.Rd
pkg/yuima/man/quasi-likelihood.Rd
Log:
updated examples and remove depends on adapt
Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION 2010-06-04 15:26:07 UTC (rev 75)
+++ pkg/yuima/DESCRIPTION 2010-06-09 22:54:49 UTC (rev 76)
@@ -1,9 +1,10 @@
Package: yuima
Type: Package
Title: The YUIMA Project package
-Version: 0.0.85
-Date: 2010-05-24
-Depends: methods, zoo, adapt, stats4
+Version: 0.0.86
+Date: 2010-06-07
+Depends: methods, zoo, stats4
+Suggets: adapt
Author: YUIMA Project Team.
Maintainer: Stefano M. Iacus <stefano.iacus at R-project.org>
Description: The YUIMA Project for Simulation and Inference
Modified: pkg/yuima/R/asymptotic_term.R
===================================================================
--- pkg/yuima/R/asymptotic_term.R 2010-06-04 15:26:07 UTC (rev 75)
+++ pkg/yuima/R/asymptotic_term.R 2010-06-09 22:54:49 UTC (rev 76)
@@ -585,10 +585,14 @@
if( k.size ==1){ # use 'integrate' if k=1
tmp <- integrate(gz_pi02,-Inf,Inf)
}else if( 2 <= k.size || k.size <= 20 ){ # use library 'adapt' to solve multi-dimentional integration
- max <- 10 * lambda.max
+ max <- 10 * lambda.max
min <- -10 * lambda.max
L <- (max - min)
- tmp <- adapt(ndim=k.size,lower=rep(min,k.size),upper=rep(max,k.size),functn=gz_pi0)
+ if(require(adapt)){
+ tmp <- adapt(ndim=k.size,lower=rep(min,k.size),upper=rep(max,k.size),functn=gz_pi0)
+ } else {
+ tmp <- NA
+ }
}else{
stop("length k is too big.")
}
@@ -1260,7 +1264,11 @@
}else if( 2 <= k.size || k.size <= 20 ){ # use 'adapt()' to solve multi-dim integration8
max <- 10*lambda.max
min <- -10*lambda.max
- tmp <- adapt(ndim=k.size,lower=rep(min,k.size),upper=rep(max,k.size),functn=gz_pi1)
+ if(require(adapt)){
+ tmp <- adapt(ndim=k.size,lower=rep(min,k.size),upper=rep(max,k.size),functn=gz_pi1)
+ } else {
+ tmp <- NA
+ }
}else{
stop("length k is too big.")
}
Modified: pkg/yuima/R/simulate.R
===================================================================
--- pkg/yuima/R/simulate.R 2010-06-04 15:26:07 UTC (rev 75)
+++ pkg/yuima/R/simulate.R 2010-06-09 22:54:49 UTC (rev 76)
@@ -207,6 +207,9 @@
yuima at data <- euler(xinit, yuima, dW, yuimaEnv)
+ for(i in 1:length(yuima at data@zoo.data))
+ time(yuima at data@zoo.data[[i]]) <- yuima at sampling@grid
+
if(missing(subsampling))
return(yuima)
subsampling(yuima, subsampling)
Modified: pkg/yuima/R/yuima.sampling.R
===================================================================
--- pkg/yuima/R/yuima.sampling.R 2010-06-04 15:26:07 UTC (rev 75)
+++ pkg/yuima/R/yuima.sampling.R 2010-06-09 22:54:49 UTC (rev 76)
@@ -1,12 +1,20 @@
+# general behaviour
+# if grid is specified, the following are derived from it
+# grid -> n, delta, Initial, Terminal, regular, random
+
+# if grid is 1-dim, no problem, but we can have more grids.
+# in this case it is better to have a listI replace grid
+# with alist
+
##Constructor and Initializer of class 'sampling'
# we convert objects to "zoo" internally
+# to be fixed: the grdi should always be prepared unless it is random sampling
-
setMethod("initialize", "yuima.sampling",
function(.Object, Initial, Terminal, n, delta, grid, random,
regular, sdelta, sgrid, oindex, interpolation){
@@ -48,31 +56,31 @@
.Object at Terminal <- max(grid)
.Object at random <- random
}else{
- # There is no grid
+# There is no grid
eqn <- length(Terminal)
if(length(Terminal)==length(n)){
.Object at Initial <- Initial
.Object at Terminal <- Terminal
.Object at n <- n
- .Object at delta <- delta
- .Object at grid <- grid
- .Object at random <- random
+ .Object at delta <- (Terminal-Initial)/n
+ .Object at grid <- seq(Initial,Terminal,by=.Object at delta)
+ .Object at random <- FALSE
.Object at regular <- regular
}else if(length(Terminal)==1){
.Object at Initial <- Initial
.Object at Terminal <- rep(Terminal, length(n))
.Object at n <- n
- .Object at delta <- delta
- .Object at grid <- grid
- .Object at random <- random
+ .Object at delta <- (Terminal-Initial)/n
+ .Object at grid <- seq(Initial,Terminal,by=.Object at delta)
+ .Object at random <- FALSE
.Object at regular <- regular
}else if(length(n)==1){
.Object at Initial <- Initial
.Object at Terminal <- Terminal
.Object at n <- rep(n, length(Terminal))
- .Object at delta <- delta
- .Object at grid <- grid
- .Object at random <- random
+ .Object at delta <- (Terminal-Initial)/n
+ .Object at grid <- seq(Initial,Terminal,by=.Object at delta)
+ .Object at random <- FALSE
.Object at regular <- regular
}else{
cat("\nDimension missmatch.\n")
Modified: pkg/yuima/man/limiting.gamma.Rd
===================================================================
--- pkg/yuima/man/limiting.gamma.Rd 2010-06-04 15:26:07 UTC (rev 75)
+++ pkg/yuima/man/limiting.gamma.Rd 2010-06-09 22:54:49 UTC (rev 76)
@@ -34,7 +34,7 @@
n <- 100
mySampling <- setSampling(Terminal=(n)^(1/3), n=n)
myYuima <- setYuima(model=myModel, sampling=mySampling)
-myYuima <- simulate(myYuima, xinit=1, true.parameter=c(0.6, 0.3))
+myYuima <- simulate(myYuima, xinit=1, true.parameter=list(theta1=0.6, theta2=0.3))
## theorical figure of theta
theta1 <- 3.5
Modified: pkg/yuima/man/quasi-likelihood.Rd
===================================================================
--- pkg/yuima/man/quasi-likelihood.Rd 2010-06-04 15:26:07 UTC (rev 75)
+++ pkg/yuima/man/quasi-likelihood.Rd 2010-06-09 22:54:49 UTC (rev 76)
@@ -51,7 +51,7 @@
ysamp <- setSampling(Terminal=(n)^(1/3), n=n)
yuima <- setYuima(model=ymodel, sampling=ysamp)
set.seed(123)
-yuima <- simulate(yuima, xinit=1, true.parameter=c(0.3, 0.1))
+yuima <- simulate(yuima, xinit=1, true.parameter=list(theta1=0.3, theta2=0.1))
QL <- ql(yuima, 0.8, 0.7, h=1/((n)^(2/3)))
QL
@@ -101,7 +101,7 @@
set.seed(123)
##xinit=c(x1, x2) #true.parameter=c(theta2.1, theta2.2, theta1.1, theta1.2)
-yuima <- simulate(yuima, xinit=c(1, 1), true.parameter=c(0.5, 0.3, 0.6, 0.2))
+yuima <- simulate(yuima, xinit=c(1, 1), true.parameter=list(theta2.1=0.5, theta2.2=0.3, theta1.1=0.6, theta1.2=0.2))
theta2 <- c(0.8, 0.2) #c(theta2.1, theta2.2)
theta1 <- c(0.7, 0.1) #c(theta1.1, theta1.2)
More information about the Yuima-commits
mailing list