gensamplepathnts: gensamplepathnts

Description Usage Arguments Value Examples

View source: R/distNTS.R

Description

gensamplepathnts generate sample paths of the NTS process with parameters (α, θ, β, γ, μ). If only three parameters are given, it generate sample paths of the standard NTS process with parameters (α, θ, β).

Usage

1
gensamplepathnts(npath, ntimestep, ntsparam, dt)

Arguments

npath

Number of sample paths

ntimestep

number of time step

ntsparam

A vector of the NTS parameters (α, θ, β, γ, μ). A vector of the standard NTS parameters (α, θ, β).

dt

the time length of one time step by the year fraction. "dt=1" means 1-year.

Value

Structure of the sample path. Matrix of sample path. Column index is time.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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')

aaron9011/temStaR-v0.814 documentation built on Dec. 24, 2021, 6:16 p.m.