Learn R Programming

Sim.DiffProc (version 4.3)

TEX.sde: Converting Sim.DiffProc Objects to LaTeX

Description

These methods produces the related LaTeX table and mathematic expression for Sim.DiffProc environment.

Usage

TEX.sde(object, …)

# S3 method for default TEX.sde(object, …)

Arguments

object

an objects from class MCM.sde and MEM.sde. Or an R vector of expression of SDEs, i.e., drift and diffusion coefficients.

arguments to be passed to kable function if object from class MCM.sde.

Details

New tools for constructing tables and mathematical expressions with Sim.DiffProc package.

An overview of this package, see browseVignettes('Sim.DiffProc') for more informations.

References

Xie Y (2015). Dynamic Documents with R and knitr. 2nd edition. Chapman and Hall/CRC, Boca Raton, Florida. ISBN 978-1498716963, URL https://yihui.name/knitr/.

Wickham H (2015). Advanced R. Chapman & Hall/CRC The R Series. CRC Press. ISBN 9781498759809.

See Also

kable create tables in LaTeX, HTML, Markdown and reStructuredText.

toLatex converting R Objects to BibTeX or LaTeX.

Examples

Run this code
# NOT RUN {
## LaTeX mathematic for an R expression of SDEs
## Copy and paste the following output in your LaTeX file

# Example 1

f <- expression(-mu1 * x) 
g <- expression(mu2 * sqrt(x)) 
TEX.sde(object = c(drift = f, diffusion = g))

# Example 2

f <- expression(mu1*cos(mu2+z),mu1*sin(mu2+z),0) 
g <- expression(sigma,sigma,alpha) 
TEX.sde(object = c(drift = f, diffusion = g))

## LaTeX mathematic for object of class 'MEM.sde'
## Copy and paste the following output in your LaTeX file

# Example 3

mem.mod3d <- MEM.sde(drift = f, diffusion = g)
TEX.sde(object = mem.mod3d)

## LaTeX table for object of class 'MCM.sde'
## Copy and paste the following output in your LaTeX file

# Example 4

# }
# NOT RUN {
mu1=0.25; mu2=3; sigma=0.05; alpha=0.03
mod3d <- snssde3d(drift=f,diffusion=g,x0=c(x=0,y=0,z=0),M=100,T=10)

stat.fun3d <- function(data, i){
   d <- data[i,]
   return(c(mean(d$x),mean(d$y),mean(d$z), 
            var(d$x),var(d$y),var(d$z)))
			}
mcm.mod3d = MCM.sde(mod3d,statistic=stat.fun3d,R=10,parallel="snow",ncpus=parallel::detectCores(),
                    names=c("m1","m2","m3","S1","S2","S3"))
					
TEX.sde(object = mcm.mod3d, booktabs = TRUE, align = "r", caption ="\LaTeX~ 
         table for Monte Carlo results generated by \code{TEX.sde()} method.")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab