Skip to content

Commit

Permalink
version 4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
acguidoum committed Mar 5, 2024
1 parent 3111798 commit 8051baf
Show file tree
Hide file tree
Showing 52 changed files with 3,177 additions and 147 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## C code.
################################################

## useDynLib("Sim.DiffProc", .registration=TRUE, .fixes="C_")
useDynLib("Sim.DiffProc", .registration=TRUE, .fixes="C_")

################################################
## import name space
Expand Down
8 changes: 6 additions & 2 deletions R/ABM.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/BB.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/BM.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/Euler.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/GBM.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/HWV.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/Heun.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
32 changes: 24 additions & 8 deletions R/MCM.sde.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Thu Apr 30 10:50:58 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down Expand Up @@ -50,9 +54,9 @@ MCM.sde.default <- function(model,statistic,R=100,time,exact=NULL,names=NULL,
stop( " please use 't0 < time <= T'")
if (any(level <= 0 | level >= 1) )
stop( " please use '0 < level < 1'")
if (class(model)=="bridgesde1d" | class(model)=="bridgesde2d" | class(model)=="bridgesde3d")
if ("bridgesde1d" %in% class(model) | "bridgesde2d" %in% class(model) | "bridgesde3d" %in% class(model))
stop("Not available for diffusion bridges")
if (class(model)!="snssde1d" & class(model)!="snssde2d" & class(model)!="snssde3d")
if (!"snssde1d" %in% class(model) & !"snssde2d" %in% class(model) & !"snssde3d" %in% class(model))
stop(" 'model' is not class of 'snssdekd', k=1,2,3. ")
if (missing(parallel))
parallel <- getOption("parallel", "no")
Expand All @@ -67,7 +71,7 @@ MCM.sde.default <- function(model,statistic,R=100,time,exact=NULL,names=NULL,
ncpus <- 1L
loadNamespace("parallel")
}
if (class(model)=="snssde1d"){
if ("snssde1d" %in% class(model)){
statistic <- match.fun(statistic)
fn1d <- function(x,...) statistic(x, ...)
rand <- matrix(0,nrow=R,ncol=model$M)
Expand Down Expand Up @@ -102,7 +106,7 @@ MCM.sde.default <- function(model,statistic,R=100,time,exact=NULL,names=NULL,
}
}
Stat <- do.call("cbind",lapply(1:R,function(i) fn1d(rand,i,...)))
}else if (class(model)=="snssde2d"){
}else if ("snssde2d" %in% class(model)){
statistic <- match.fun(statistic)
fn2d <- function(x,...) statistic(x, ...)
rand <- matrix(0,nrow=2*R,ncol=model$M)
Expand Down Expand Up @@ -143,7 +147,7 @@ MCM.sde.default <- function(model,statistic,R=100,time,exact=NULL,names=NULL,
rand1 <- list(x=rand[seq(1,2*R,by=2),],y=rand[seq(2,2*R,by=2),])
rand2 <- lapply(1:R,function(i) data.frame(x=rand1$x[i,], y=rand1$y[i,]))
Stat <- do.call("cbind",lapply(1:R,function(i) fn2d(rand2[[i]],...)))
}else if (class(model)=="snssde3d"){
}else if ("snssde3d" %in% class(model)){
statistic <- match.fun(statistic)
fn3d <- function(x,...) statistic(x, ...)
rand <- matrix(0,nrow=3*R,ncol=model$M)
Expand Down Expand Up @@ -270,7 +274,19 @@ print.MCM.sde <- function(x, digits=NULL, ...)
" | t in [",format(x$mod$t0,digits=digits),",",format(x$mod$T,digits=digits),"] with mesh equal to ",format(x$mod$Dt,digits=digits),"\n",
sep="")}
}} else {
if (x$Class=="snssde2d"){
if (x$Class=="snssde1d"){
Dr <- deparse(eval(substitute(substitute(e, list(x=quote(X(t)))), list(e = x$mod$drift))))
DD <- deparse(eval(substitute(substitute(e, list(x=quote(X(t)))), list(e = x$mod$diffusion))))
if(x$mod$type=="ito"){
cat(Ito," Sde 1D:","\n",
" | dX(t) = ", Dr," * dt + ", DD," * dW(t)","\n",
" | t in [",format(x$mod$t0,digits=digits),",",format(x$mod$T,digits=digits),"] with mesh equal to ",format(x$mod$Dt,digits=digits),"\n",
sep="")}else{
cat("Stratonovich Sde 1D:","\n",
" | dX(t) = ", Dr," * dt + ", DD," o dW(t)","\n",
" | t in [",format(x$mod$t0,digits=digits),",",format(x$mod$T,digits=digits),"] with mesh equal to ",format(x$mod$Dt,digits=digits),"\n",
sep="")}
}else if (x$Class=="snssde2d"){
Drx <- deparse(eval(substitute(substitute(e, list(x=quote(X(t)),y=quote(Y(t)))), list(e = x$mod$driftx))))
DDx <- deparse(eval(substitute(substitute(e, list(x=quote(X(t)),y=quote(Y(t)))), list(e = x$mod$diffx))))
Dry <- deparse(eval(substitute(substitute(e, list(x=quote(X(t)),y=quote(Y(t)))), list(e = x$mod$drifty))))
Expand Down
8 changes: 6 additions & 2 deletions R/MEM.sde.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Thu Apr 30 10:50:58 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/Milstein.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/OU.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/PredCorr.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/RK.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/SMilstein.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
8 changes: 6 additions & 2 deletions R/STS.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Fri Apr 03 08:54:53 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
36 changes: 20 additions & 16 deletions R/Tex.sde.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Thu Apr 30 10:50:58 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down Expand Up @@ -190,14 +194,14 @@ TEX.sde.default <- function(object, ...)
greek_env
}
# core function
if (class(object) == "data.frame"){
if ("data.frame" %in% class(object)){
cat("%%% LaTeX table generated in R",strsplit(version[['version.string']], ' ')[[1]][3],"by TEX.sde() method",
"\n")
cat("%%% Copy and paste the following output in your LaTeX file",
"\n\n")
cat(knitr::kable(object, format = "latex",...),
"\n")
}else if (class(object) == "MCM.sde"){
}else if ("MCM.sde" %in% class(object)){
tab <- object$MC
expr <- parse(text = rownames(tab))
# greek_test <- as.list(c(mem_sde,mem_sde_tex,expr,
Expand Down Expand Up @@ -226,7 +230,7 @@ TEX.sde.default <- function(object, ...)
"\n\n")
cat(knitr::kable(tab, format = "latex", escape = FALSE,...),
"\n")
}else if (class(object) == "expression"){
}else if ("expression" %in% class(object)){
expr <- object
names <- all.names(expr)
symbol_list <- setNames(as.list(names), names)
Expand Down Expand Up @@ -276,7 +280,7 @@ TEX.sde.default <- function(object, ...)
body <- c(body, paste("\\end{cases}"))
body <- c(body, paste("\\end{equation}"))
structure(body, class = "Latex")}
}else if (class(object) == "MEM.sde"){
}else if ("MEM.sde" %in% class(object)){
if (object$dim==1){
expr <- c(parse(text = deparse(object$Means)),parse(text = deparse(object$Var)))
names <- all.names(expr)
Expand Down Expand Up @@ -314,10 +318,10 @@ TEX.sde.default <- function(object, ...)
body <- c(body, paste("\\begin{equation}\\label{eq:}"))
body <- c(body, paste("\\begin{cases}"))
body <- c(body, paste("\\begin{split}"))
body <- c(body,paste("\\frac{d}{dt} m_{1}(t) ~&=",dm1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{2}(t) ~&=",dm2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{1}(t) ~&=",dS1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{2}(t) ~&=",dS2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{1}(t) &=",dm1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{2}(t) &=",dm2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{1}(t) &=",dS1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{2}(t) &=",dS2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} C_{12}(t) &=",dC12))
body <- c(body, paste("\\end{split}"))
body <- c(body, paste("\\end{cases}"))
Expand Down Expand Up @@ -345,12 +349,12 @@ TEX.sde.default <- function(object, ...)
body <- c(body, paste("\\begin{equation}\\label{eq:}"))
body <- c(body, paste("\\begin{cases}"))
body <- c(body, paste("\\begin{split}"))
body <- c(body,paste("\\frac{d}{dt} m_{1}(t) ~&=",dm1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{2}(t) ~&=",dm2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{3}(t) ~&=",dm3,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{1}(t) ~&=",dS1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{2}(t) ~&=",dS2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{3}(t) ~&=",dS3,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{1}(t) &=",dm1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{2}(t) &=",dm2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} m_{3}(t) &=",dm3,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{1}(t) &=",dS1,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{2}(t) &=",dS2,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} S_{3}(t) &=",dS3,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} C_{12}(t) &=",dC12,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} C_{13}(t) &=",dC13,"\\\\"))
body <- c(body,paste("\\frac{d}{dt} C_{23}(t) &=",dC23))
Expand Down
8 changes: 6 additions & 2 deletions R/bridgesde.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Thu Apr 30 10:50:58 2020
## Original file Copyright © 2020 A.C. Guidoum, K. Boukhetala
## Tue Mar 5 18:13:25 2024
## Original file Copyright © 2024 A.C. Guidoum, K. Boukhetala
## This file is part of the R package Sim.DiffProc
## Department of Mathematics and Computer Science,
## Faculty of Sciences and Technology,
## University of Tamanghasset
## and
## Department of Probabilities & Statistics
## Faculty of Mathematics
## University of Science and Technology Houari Boumediene
Expand Down
Loading

0 comments on commit 8051baf

Please sign in to comment.