[Yuima-commits] r61 - in pkg/yuima: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 25 06:55:50 CET 2010


Author: hinohide
Date: 2010-01-25 06:55:50 +0100 (Mon, 25 Jan 2010)
New Revision: 61

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/rng.R
Log:
add error check code for rng.r

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2010-01-20 08:55:35 UTC (rev 60)
+++ pkg/yuima/DESCRIPTION	2010-01-25 05:55:50 UTC (rev 61)
@@ -1,8 +1,8 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project package
-Version: 0.0.84
-Date: 2010-01-20
+Version: 0.0.85
+Date: 2010-01-25
 Depends: methods, zoo, adapt, stats4
 Author: YUIMA Project Team.
 Maintainer: Stefano M. Iacus <stefano.iacus at R-project.org>

Modified: pkg/yuima/R/rng.R
===================================================================
--- pkg/yuima/R/rng.R	2010-01-20 08:55:35 UTC (rev 60)
+++ pkg/yuima/R/rng.R	2010-01-25 05:55:50 UTC (rev 61)
@@ -52,6 +52,15 @@
     return(X)
     
   }else{ ## multivariate case
+    if( nrow(Lambda)!=ncol(Lambda)){
+      stop("Lambda must be a square matrix.")
+    }
+    if( nrow(Lambda)!=length(beta)){
+      stop("Dimension of Lambda and beta must be equal.")
+    }
+    if( sum(eigen(Lambda)$values <= 0 ) > 0){
+      stop("Lambda must be positive definite.")
+    }
     if( det(Lambda) < 10^(-15)){
       stop("Determinant of Lambda must be one.")
     }
@@ -63,7 +72,7 @@
       stop("alpha must be positive value.")
     if( tmp <=0)
       stop("alpha^2 - beta^2*mu must be positive value.")
-  
+    
     tau <- rgamma(x,lambda,tmp/2)
     eta <- rnorm(x*length(beta))
     sqrt.L <- svd(Lambda)



More information about the Yuima-commits mailing list