gensamplepathnts | R Documentation |
gensamplepathnts
generate sample paths
of the NTS process with parameters (\alpha, \theta, \beta, \gamma, \mu)
.
If only three parameters are given, it generate sample paths
of the standard NTS process with parameters (\alpha, \theta, \beta)
.
gensamplepathnts(npath, ntimestep, ntsparam, dt)
npath |
Number of sample paths |
ntimestep |
number of time step |
ntsparam |
A vector of the NTS parameters |
dt |
the time length of one time step by the year fraction. "dt=1" means 1-year. |
Structure of the sample path. Matrix of sample path. Column index is time.
library("temStaR")
#standard NTS process sample path
alpha <- 1.2
theta <- 1
beta <- -0.2
ntsparam <- c(alpha, theta, beta)
npath <- 5
ntimestep <- 250
dt <- 1/250
simulation <- gensamplepathnts(npath, ntimestep, ntsparam, dt)
matplot(colnames(simulation), t(simulation), type = 'l')
#NTS process sample path
alpha <- 1.2
theta <- 1
beta <- -0.2
gamma <- 0.3
mu <- 0.1
ntsparam <- c(alpha, theta, beta, gamma, mu)
npath <- 5
ntimestep <- 250
dt <- 1/250
simulation <- gensamplepathnts(npath, ntimestep, ntsparam, dt)
matplot(colnames(simulation), t(simulation), type = 'l')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.