Description Usage Arguments Details Value Author(s) See Also Examples
Random number and trajectory generation of the state variables. The
state variables are the commodity spot price s0
and the spot
convenience yield delta0
. The commodity log spot price and the
convenience yield follow a bivariate normal distribution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## S4 method for signature 'ANY,ANY,numeric'
rstate(n, time = 1, s0 = 50, delta0 = 0,
mu = 0.1, sigmaS = 0.3, kappa = 1, alpha = 0,
sigmaE = 0.5, rho = 0.75, method = "chol")
## S4 method for signature 'ANY,ANY,schwartz2f'
rstate(n, time = 1, s0, method = "chol")
## S4 method for signature 'ANY,ANY,numeric'
simstate(n, time = 1, s0 = 50, delta0 = 0,
mu = 0.1, sigmaS = 0.3, kappa = 1, alpha = 0,
sigmaE = 0.5, rho = 0.75, method = "chol")
## S4 method for signature 'ANY,ANY,schwartz2f'
simstate(n, time = 1, s0, method = "chol")
|
n |
Number of observations. |
time |
at which random numbers of the state variables are drawn ( |
s0 |
Either a |
delta0 |
Initial value of the convenience yield. |
mu |
enters the drift of the commodity spot price. |
sigmaS |
Diffusion parameter of the spot price-process. |
kappa |
Speed of mean-reversion of the convenience yield process. |
alpha |
Mean-level of the convenience yield process. |
sigmaE |
Diffusion parameter of the convenience yield process. |
rho |
Correlation coefficient between the Brownian motion driving the spot price and the convenience yield process. |
method |
See |
The model and its parameters are described in the Details
section of the schwartz2f
-class
documentation and in the package vignette Technical Document.
The above methods rely on the functions
pmvnorm
,
dmvnorm
,
qmvnorm
and
rmvnorm
of the package
mvtnorm
.
Samples or trajectories of the commodity spot price and instantaneous
spot convenience yield as matrix
.
Philipp Erb, David Luethi, Juri Hinz
schwartz2f
-class
description.
d/p/q/state
for the density, distribution,
and quantile function of the state variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Create a "schwartz2f"-object
model <- schwartz2f()
## and sample from its distribution at time = 2.5.
sim <- rstate(n = 1000, s0 = model, time = 2.5)
par(mfrow = c(1, 2))
hist(sim[,1], main = "Distribution of Spot Price")
hist(sim[,2], main = "Distribution of Convenience Yield")
## Create a trajectory over a 6 years horizon sampled on a weekly basis.
trajectory <- simstate(6 * 52, time = 6, s0 = model)
par(mfrow = c(1, 2))
plot(trajectory[,1], main = "Spot Price", type = "l")
plot(trajectory[,2], main = "Convenience Yield", type = "l")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.