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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 3 10:48:41 CEST 2016


Author: lorenzo
Date: 2016-10-03 10:48:40 +0200 (Mon, 03 Oct 2016)
New Revision: 469

Added:
   pkg/yuima/R/yuima.law.r
   pkg/yuima/man/info.Map.Rd
   pkg/yuima/man/param.Map.Rd
   pkg/yuima/man/setLaw.Rd
   pkg/yuima/man/yuima.Map-class.Rd
   pkg/yuima/man/yuima.law-class.rd
Removed:
   pkg/yuima/man/info.Output.Rd
   pkg/yuima/man/param.Output.Rd
   pkg/yuima/man/yuima.Output-class.Rd
Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/NAMESPACE
   pkg/yuima/R/FunctionAndOperators.R
   pkg/yuima/R/NewClasses.R
   pkg/yuima/R/PointProcessClasses.R
   pkg/yuima/R/simulateForMapsIntegralAndOperator.R
   pkg/yuima/man/setMap.Rd
Log:
New classes (Map, Inegral, Ppr, Law)

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/DESCRIPTION	2016-10-03 08:48:40 UTC (rev 469)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.1.7
+Version: 1.1.8
 Depends: R(>= 2.10.0), methods, zoo, stats4, utils, expm, cubature, mvtnorm
 Imports: Rcpp (>= 0.12.1)
 Author: YUIMA Project Team

Modified: pkg/yuima/NAMESPACE
===================================================================
--- pkg/yuima/NAMESPACE	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/NAMESPACE	2016-10-03 08:48:40 UTC (rev 469)
@@ -63,6 +63,7 @@
 
 exportClasses("yuima",
 "yuima.data",
+"yuima.law",
 "yuima.sampling",
 "yuima.characteristic",
 "yuima.model",
@@ -75,9 +76,9 @@
 "yuima.CP.qmle",
 "cogarch.info",
 "yuima.cogarch",
-"yuima.Output",
-"info.Output",
-"param.Output",
+"yuima.Map",
+"info.Map",
+"param.Map",
 "yuima.multimodel",
 "param.Integral",
 "variable.Integral",
@@ -133,7 +134,7 @@
 export(setHawkes)
 export(dconst)
 export(rconst)
-
+export(setLaw)
 export(setCogarch)
 export(setMap)
 #export(setMultiModel)

Modified: pkg/yuima/R/FunctionAndOperators.R
===================================================================
--- pkg/yuima/R/FunctionAndOperators.R	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/R/FunctionAndOperators.R	2016-10-03 08:48:40 UTC (rev 469)
@@ -177,7 +177,7 @@
   if(length(out.var)==1){
     out.var<-rep(out.var,ddd)
   }
-  param <- new("param.Output",
+  param <- new("param.Map",
                out.var = out.var,
                allparam = unique(c(paramfunc,mod at parameter@all)),
                allparamMap = paramfunc,
@@ -185,11 +185,11 @@
                Input.var = mod at solve.variable,
                time.var=mod at time.variable)
 
-  objFunc <- new("info.Output", formula = funcList,
+  objFunc <- new("info.Map", formula = funcList,
                  dimension=dimens, type = type,
                  param=param)
 
-  res<-new("yuima.Output",
+  res<-new("yuima.Map",
            Output = objFunc,
            yuima=yuima )
 

Modified: pkg/yuima/R/NewClasses.R
===================================================================
--- pkg/yuima/R/NewClasses.R	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/R/NewClasses.R	2016-10-03 08:48:40 UTC (rev 469)
@@ -1,5 +1,5 @@
 # Here we insert new classes for extending the object of classes yuima
-setClass("param.Output",
+setClass("param.Map",
          representation(out.var = "character",
                         allparam = "character",
                         allparamMap = "character",
@@ -7,22 +7,22 @@
                         Input.var = "character",
                         time.var = "character"))
 
-setClass("info.Output",
+setClass("info.Map",
          representation(formula="list",
                         dimension="numeric",
                         type="character",
-                        param = "param.Output"))
+                        param = "param.Map"))
 
 
-setClass("yuima.Output",
-         representation(Output = "info.Output"),
+setClass("yuima.Map",
+         representation(Output = "info.Map"),
          contains="yuima"
            )
 
 # Initialization
 
 setMethod("initialize",
-           "param.Output",
+           "param.Map",
            function(.Object, out.var = character(),
                     allparam = character(),
                     allparamMap = character(),
@@ -40,11 +40,11 @@
 )
 #
 setMethod("initialize",
-          "info.Output", function(.Object,
+          "info.Map", function(.Object,
                                   formula = list(),
                                   dimension = numeric(),
                                   type = character(),
-                                  param = new("param.Output")){
+                                  param = new("param.Map")){
                             .Object at formula <- formula
                             .Object at dimension <- dimension
                             .Object at type <- type
@@ -54,10 +54,10 @@
           )
 
 setMethod("initialize",
-          "yuima.Output",
+          "yuima.Map",
           function(.Object,
-                   #param = new("param.Output"),
-                   Output = new("info.Output"),
+                   #param = new("param.Map"),
+                   Output = new("info.Map"),
                    yuima = new("yuima")){
             #.Object at param <- param
             .Object at Output <- Output

Modified: pkg/yuima/R/PointProcessClasses.R
===================================================================
--- pkg/yuima/R/PointProcessClasses.R	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/R/PointProcessClasses.R	2016-10-03 08:48:40 UTC (rev 469)
@@ -14,7 +14,7 @@
 
 setClass("yuima.Ppr",
          representation(Ppr = "info.Ppr",
-                        gFun = "info.Output",
+                        gFun = "info.Map",
                         Kernel = "Integral.sde"),
          contains="yuima"
 )
@@ -52,7 +52,7 @@
           "yuima.Ppr",
           function(.Object,
                    Ppr = new("info.Ppr"),
-                   gFun = new("info.Output"),
+                   gFun = new("info.Map"),
                    Kernel = new("Integral.sde"),
                    yuima = new("yuima")){
             #.Object at param <- param

Modified: pkg/yuima/R/simulateForMapsIntegralAndOperator.R
===================================================================
--- pkg/yuima/R/simulateForMapsIntegralAndOperator.R	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/R/simulateForMapsIntegralAndOperator.R	2016-10-03 08:48:40 UTC (rev 469)
@@ -1,5 +1,5 @@
 # Method for Map
-setMethod("simulate", "yuima.Output",
+setMethod("simulate", "yuima.Map",
                     function(object, nsim=1, seed=NULL, xinit, true.parameter,
                              space.discretized=FALSE, increment.W=NULL, increment.L=NULL, method="euler",
                              hurst, methodfGn="WoodChan",
@@ -51,7 +51,7 @@
       my.data<-cbind(my.data,
         eval(object at Output@formula[[i]]))
     }
-  }  
+  }
   names(my.data)<-object at Output@param at out.var
 
   data1 <- setData(my.data)

Added: pkg/yuima/R/yuima.law.r
===================================================================
--- pkg/yuima/R/yuima.law.r	                        (rev 0)
+++ pkg/yuima/R/yuima.law.r	2016-10-03 08:48:40 UTC (rev 469)
@@ -0,0 +1,135 @@
+## Distribution Law
+
+setClass("yuima.law",representation(rng = "function",
+                                    density = "function",
+                                    cdf = "function",
+                                    param.measure = "character",
+                                    characteristic = "function",
+                                    time.var = "character",
+                                    rand.var = "character",
+                                    charact.var = "character",
+                                    dim = "numLike")
+           )
+
+setMethod("initialize", "yuima.law",
+                function(.Object,
+                         rng = function(x,...){},
+                         density = function(x,...){},
+                         cdf = function(x,...){},
+                         param.measure = character(),
+                         characteristic = function(u,...){},
+                         time.var = character(),
+                         rand.var = character(),
+                         charact.var = character(),
+                         dim = NA
+                ){
+                  .Object at rng <- rng
+                  .Object at density <- density
+                  .Object at cdf <- cdf
+                  .Object at param.measure <- param.measure
+                  .Object at characteristic <- characteristic
+                  .Object at time.var <- time.var
+                  .Object at rand.var <- rand.var
+                  .Object at charact.var <- charact.var
+                  .Object at dim <- dim
+                  return(.Object)
+                }
+)
+
+#  Constructor
+
+setLaw <- function(rng = function(x,...){NULL},
+                   density = function(x,...){NULL},
+                   cdf = function(x,...){NULL},
+                   characteristic = function(u,...){NULL},
+                   time.var="t",
+                   rand.var = "x",
+                   character.var = "u",
+                   dim = NA){
+
+  param.rng <- extrapParam(myfun = rng, time.var = time.var, aux.var = rand.var )
+  CondRng<- FALSE
+  if(all(param.rng %in% "...")){
+    yuima.warn("rng is not defined")
+  }else{
+    CondRng <- TRUE
+    param <- param.rng
+  }
+
+  param.dens <- extrapParam(myfun = density, time.var = time.var, aux.var = rand.var )
+  CondDens<- FALSE
+  if(all(param.dens %in% "...")){
+    yuima.warn("density is not defined")
+  }else{
+    CondDens <- TRUE
+    param <- param.dens
+  }
+
+  if(CondDens){
+    if(CondRng){
+      if(!all(param.dens %in%  param.rng)){
+        yuima.stop("dens and rng  have different parameters")
+      }
+    }
+  }
+
+  param.cdf <- extrapParam(myfun = cdf, time.var = time.var, aux.var = rand.var )
+  Condcdf<- FALSE
+  if(all(param.cdf %in% "...")){
+    yuima.warn("cdf is not defined")
+  }else{
+    Condcdf <- TRUE
+  }
+
+  if(Condcdf){
+    if(!all(param %in%  param.cdf)){
+      yuima.stop("cdf has different parameters")
+    }
+  }
+
+  param.char <- extrapParam(myfun = characteristic,
+                            time.var = time.var,
+                            aux.var = character.var )
+
+  Condchar<- FALSE
+  if(all(param.char %in% "...")){
+    yuima.warn("char is not defined")
+  }else{
+    Condchar <- TRUE
+  }
+
+  if(Condchar){
+    if(!all(param %in%  param.char)){
+      yuima.stop("char has different parameters")
+    }
+  }
+
+  res <- new("yuima.law",
+             rng = rng,
+             density = density,
+             cdf = cdf,
+             characteristic = characteristic,
+             param.measure = param,
+             time.var = time.var,
+             rand.var = rand.var,
+             charact.var = character.var,
+             dim = NA)
+  return(res)
+}
+
+extrapParam <- function(myfun, time.var, aux.var){
+  dummy <- names(as.list(args(myfun)))
+  dummy <- dummy[-length(dummy)]
+  if(dummy[1] != aux.var){
+    yuima.stop("Change rand.var or charac.var ...")
+  }
+  cond <- dummy %in% time.var
+  # if(!any(cond)){
+  #   yuima.warn("The yuima.law is the distribution
+  #              of the jump size, in a CP process")
+  # }
+
+  dummy.par <- dummy[!cond]
+  dummy <- dummy.par[!dummy.par%in%aux.var]
+  return(dummy)
+}

Added: pkg/yuima/man/info.Map.Rd
===================================================================
--- pkg/yuima/man/info.Map.Rd	                        (rev 0)
+++ pkg/yuima/man/info.Map.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -0,0 +1,11 @@
+\name{info.Map-class}
+\docType{class}
+\alias{info.Map}
+\alias{info.Map-class}
+\alias{initialize,info.Map-method}
+
+\title{Class for information about Map/Operators}
+\description{
+Auxiliar class for definition of an object of class \code{\link{yuima.Map}}. see the documentation of \code{\link{yuima.Map}} for more details.
+}
+

Deleted: pkg/yuima/man/info.Output.Rd
===================================================================
--- pkg/yuima/man/info.Output.Rd	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/man/info.Output.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -1,11 +0,0 @@
-\name{info.Output-class}
-\docType{class}
-\alias{info.Output}
-\alias{info.Output-class}
-\alias{initialize,info.Output-method}
-
-\title{Class for information about Map/Operators}
-\description{
-Auxiliar class for definition of an object of class \code{\link{yuima.Output}}. see the documentation of \code{\link{yuima.Output}} for more details.
-}
-

Added: pkg/yuima/man/param.Map.Rd
===================================================================
--- pkg/yuima/man/param.Map.Rd	                        (rev 0)
+++ pkg/yuima/man/param.Map.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -0,0 +1,11 @@
+\name{param.Map-class}
+\docType{class}
+\alias{param.Map}
+\alias{param.Map-class}
+\alias{initialize,param.Map-method}
+
+\title{Class for information about Map/Operators}
+\description{
+Auxiliar class for definition of an object of class \code{\link{yuima.Map}}. see the documentation of \code{\link{yuima.Map}} for more details.
+}
+

Deleted: pkg/yuima/man/param.Output.Rd
===================================================================
--- pkg/yuima/man/param.Output.Rd	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/man/param.Output.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -1,11 +0,0 @@
-\name{param.Output-class}
-\docType{class}
-\alias{param.Output}
-\alias{param.Output-class}
-\alias{initialize,param.Output-method}
-
-\title{Class for information about Map/Operators}
-\description{
-Auxiliar class for definition of an object of class \code{\link{yuima.Output}}. see the documentation of \code{\link{yuima.Output}} for more details.
-}
-

Added: pkg/yuima/man/setLaw.Rd
===================================================================
--- pkg/yuima/man/setLaw.Rd	                        (rev 0)
+++ pkg/yuima/man/setLaw.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -0,0 +1,48 @@
+\name{setLaw}
+\alias{setLaw}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{Random variable constructor }
+\description{Constructor of a random variable}
+\usage{
+setLaw(rng = function(x, ...) {
+    NULL
+}, density = function(x, ...) {
+    NULL
+}, cdf = function(x, ...) {
+    NULL
+}, characteristic = function(u, ...) {
+    NULL
+}, time.var = "t", rand.var = "x", character.var = "u", dim = NA)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{rng}{
+function}
+  \item{density}{
+function}
+  \item{cdf}{
+function}
+  \item{characteristic}{
+function
+}
+  \item{time.var}{
+label}
+  \item{rand.var}{
+label}
+  \item{character.var}{
+label}
+  \item{dim}{
+label}
+}
+\details{
+Insert additional info}
+\value{
+object of class yuima.law}
+\author{
+YUIMA TEAM}
+\note{
+Insert additional info}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+%%\examples{}

Modified: pkg/yuima/man/setMap.Rd
===================================================================
--- pkg/yuima/man/setMap.Rd	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/man/setMap.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -7,7 +7,7 @@
 Map of a Stochastic Differential Equation
 }
 \description{
-'\code{setMap}' is the constructor of an object of class \code{\link{yuima.Output}} that describes a map of a SDE
+'\code{setMap}' is the constructor of an object of class \code{\link{yuima.Map}} that describes a map of a SDE
 }
 \usage{
 setMap(func, yuima, out.var = "", nrow = 1, ncol = 1)
@@ -17,13 +17,13 @@
   \item{func}{a matrix or a vector of strings that describe each component of the map.}
   \item{yuima}{ an object of class \code{\link{yuima.model}} that is the SDE.}
   \item{out.var}{ label for the output}
-  \item{nrow}{ dimension of output if \code{func} is a vector of string. }
+  \item{nrow}{ dimension of Map if \code{func} is a vector of string. }
   \item{ncol}{ dimension of output if \code{func} is a vector of string.}
 }
 %\details{
 %%  ~~ If necessary, more details than the description above ~~
 %}
-\value{The constructor returns an object of class \code{\link{yuima.Output}}.}
+\value{The constructor returns an object of class \code{\link{yuima.Map}}.}
 \references{Yuima Documentation}
 \author{The YUIMA Project Team}
 %\note{
@@ -46,7 +46,7 @@
   "a*exp(X-a1*t)","b*exp(Y-a2*t)"),
   nrow=2,ncol=2)
 
-# Construction of yuima.Output
+# Construction of yuima.Map
 
 yuimaMap <- setMap(func = my.Map, yuima = mod,
   out.var = c("f11","f21","f12","f22"))

Added: pkg/yuima/man/yuima.Map-class.Rd
===================================================================
--- pkg/yuima/man/yuima.Map-class.Rd	                        (rev 0)
+++ pkg/yuima/man/yuima.Map-class.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -0,0 +1,56 @@
+\name{yuima.Map-class}
+\docType{class}
+\alias{yuima.Map-class}
+\alias{yuima.Map}
+%\alias{info.Map}
+%\alias{param.Map}
+\alias{initialize,yuima.Map-method}
+\alias{simulate,yuima.Map-method}
+
+
+\title{Class for the mathematical description of function of a stochastic process}
+\description{
+  The \code{yuima.Map} class is a class of the  \pkg{yuima} package that extends the \code{\link{yuima-class}} it represents a map of a stochastic process
+
+  \code{ zt = g(theta, Xt, t) : R^{q x d x 1} -> R^{l1 x l2 x ...}}
+
+or an operator between two independent stochasic process:
+
+  \code{ zt = h(theta, Xt, Yt, t)}
+
+where \code{Xt} and \code{Yt}  are object of class \code{\link{yuima.model-class}} or \code{\link{yuima-class}} with the same dimension.
+}
+
+\section{Slots}{
+Here we report the additional slots of an object of class \code{yuima.Map} with respect to the \code{\link{yuima-class}}:
+  \describe{
+    \item{\code{Output}:}{It is an object of class \code{info.Map} and it is composed by the following slots:
+    \describe{
+        \item{\code{formula}:}{It is a \code{list} that contains the components of map \code{g(theta, Xt, t)} or the operator \code{h(theta, Xt, Yt, t)} }
+        \item{\code{dimension}:}{a \code{numeric} object that is the dimensions of the Map.}
+        \item{\code{type}:}{If \code{type = "Maps"}, the Map is a map of stochastic process, If \code{type = "Operator"}, the result is an operator between two independent stochastic process}
+       \item{\code{param}}{it is an object of class \code{param.Map} and it is composed by the following slots:
+       \describe{
+          \item{\code{out.var}:}{labels for Map.}
+          \item{\code{allparam}:}{labels of all parameters (model and  map/operators).}
+          \item{\code{allparamMap}:}{labels of map/operator parameters.}
+          \item{\code{common}:}{common parameters.}
+          \item{\code{Input.var}:}{labels for inputs.}
+          \item{\code{time.var}:}{label for time variable.}
+        }
+       }
+      }
+    }
+  }
+}
+
+\section{Methods}{
+  \describe{
+    \item{simulate}{simulation method. For more information see
+	  \code{\link{simulate}}.}
+%    \item{toLatex}{This method converts an object of \code{yuima.poisson-class} to character vectors with LaTeX markup.}
+%    \item{qmle}{Quasi maximum likelihood estimation procedure. For more information see \code{\link{qmle}}. }
+  }
+}
+\author{The YUIMA Project Team}
+\keyword{classes}

Deleted: pkg/yuima/man/yuima.Output-class.Rd
===================================================================
--- pkg/yuima/man/yuima.Output-class.Rd	2016-09-23 09:55:34 UTC (rev 468)
+++ pkg/yuima/man/yuima.Output-class.Rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -1,56 +0,0 @@
-\name{yuima.Output-class}
-\docType{class}
-\alias{yuima.Output-class}
-\alias{yuima.Output}
-%\alias{info.Output}
-%\alias{param.Output}
-\alias{initialize,yuima.Output-method}
-\alias{simulate,yuima.Output-method}
-
-
-\title{Class for the mathematical description of function of a stochastic process}
-\description{
-  The \code{yuima.Output} class is a class of the  \pkg{yuima} package that extends the \code{\link{yuima-class}} it represents a map of a stochastic process
-
-  \code{ zt = g(theta, Xt, t) : R^{q x d x 1} -> R^{l1 x l2 x ...}}
-
-or an operator between two independent stochasic process:
-
-  \code{ zt = h(theta, Xt, Yt, t)}
-
-where \code{Xt} and \code{Yt}  are object of class \code{\link{yuima.model-class}} or \code{\link{yuima-class}} with the same dimension.
-}
-
-\section{Slots}{
-Here we report the additional slots of an object of class \code{yuima.Output} with respect to the \code{\link{yuima-class}}:
-  \describe{
-    \item{\code{Output}:}{It is an object of class \code{info.Output} and it is composed by the following slots:
-    \describe{
-        \item{\code{formula}:}{It is a \code{list} that contains the components of map \code{g(theta, Xt, t)} or the operator \code{h(theta, Xt, Yt, t)} }
-        \item{\code{dimension}:}{a \code{numeric} object that is the dimensions of the output.}
-        \item{\code{type}:}{If \code{type = "Maps"}, the output is a map of stochastic process, If \code{type = "Operator"}, the result is an operator between two independent stochastic process}
-       \item{\code{param}}{it is an object of class \code{param.Output} and it is composed by the following slots:
-       \describe{
-          \item{\code{out.var}:}{labels for output.}
-          \item{\code{allparam}:}{labels of all parameters (model and  map/operators).}
-          \item{\code{allparamMap}:}{labels of map/operator parameters.}
-          \item{\code{common}:}{common parameters.}
-          \item{\code{Input.var}:}{labels for inputs.}
-          \item{\code{time.var}:}{label for time variable.}
-        }
-       }
-      }
-    }
-  }
-}
-
-\section{Methods}{
-  \describe{
-    \item{simulate}{simulation method. For more information see
-	  \code{\link{simulate}}.}
-%    \item{toLatex}{This method converts an object of \code{yuima.poisson-class} to character vectors with LaTeX markup.}
-%    \item{qmle}{Quasi maximum likelihood estimation procedure. For more information see \code{\link{qmle}}. }
-  }
-}
-\author{The YUIMA Project Team}
-\keyword{classes}

Added: pkg/yuima/man/yuima.law-class.rd
===================================================================
--- pkg/yuima/man/yuima.law-class.rd	                        (rev 0)
+++ pkg/yuima/man/yuima.law-class.rd	2016-10-03 08:48:40 UTC (rev 469)
@@ -0,0 +1,39 @@
+\name{yuima.law-class}
+\docType{class}
+\alias{yuima.law-class}
+\alias{yuima.law}
+\alias{initialize,yuima.law-method}
+
+
+\title{Class of yuima law}
+
+\description{Insert Description Here}
+
+\section{Slots}{...:
+\describe{
+  \item{rng}{
+  function}
+    \item{density}{
+  function}
+    \item{cdf}{
+  function}
+    \item{param.measure}{...}
+    \item{characteristic}{
+  function
+  }
+    \item{time.var}{
+  label}
+    \item{rand.var}{
+  label}
+    \item{charact.var}{
+  label}
+    \item{dim}{
+  number}
+}
+}
+
+\section{Methods}{...}
+
+\author{The YUIMA Project Team}
+\keyword{classes}
+



More information about the Yuima-commits mailing list