Description Usage Arguments Details Value Author(s) See Also Examples
Density, distribution function and quantile function of the state
variables. The state variables are the commodity spot price s
and the spot convenience yield delta. 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 16 17 18 19 20 21 22 23 24  | ## S4 method for signature 'ANY,ANY,numeric'
dstate(x, time = 1, s0 = 50, delta0 = 0,
       mu = 0.1, sigmaS = 0.3, kappa = 1, alpha = 0,
       sigmaE = 0.5, rho = 0.75, ...)
## S4 method for signature 'ANY,ANY,schwartz2f'
dstate(x, time = 1, s0, ...)
## S4 method for signature 'ANY,ANY,ANY,numeric'
pstate(lower, upper, time = 1, s0 = 50, delta0 = 0,
       mu = 0.1, sigmaS = 0.3, kappa = 1, alpha = 0,
       sigmaE = 0.5, rho = 0.75, ...)
## S4 method for signature 'ANY,ANY,ANY,schwartz2f'
pstate(lower, upper, time = 1, s0, ...)
## S4 method for signature 'ANY,ANY,numeric'
qstate(p, time = 1, s0 = 50, delta0 = 0,
       mu = 0.1, sigmaS = 0.3, kappa = 1, alpha = 0,
       sigmaE = 0.5, rho = 0.75, tail = "lower.tail", ...)
## S4 method for signature 'ANY,ANY,schwartz2f'
qstate(p, time = 1, s0, tail = "lower.tail", ...)
 | 
x | 
 Vector or matrix of quantiles. If   | 
time | 
 Time at which the quantity is computed (relative to time zero).  | 
p | 
 Probability, a scalar.  | 
lower | 
 The vector of lower limits of length 2. Note that first component stands for lower limit of the commodity spot price rather than the log-price.  | 
upper | 
 The vector of upper limits of length 2. Note that first component stands for the upper limit of the commodity spot price rather than the log-price.  | 
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.  | 
tail | 
 See   | 
... | 
 Further arguments to be passed to methods of package
  | 
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, and
qmvnorm 
of the package
mvtnorm.
dstate and pstate return a numeric, qstate
returns the output of qmvnorm as a list.
Philipp Erb, David Luethi, Juri Hinz
schwartz2f-class description,
rstate and simstate for random number
generation, constructors schwartz2f and
fit.schwartz2f.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  | # ## Create a "schwartz2f"-object
# model <- schwartz2f()
# 
# ## Probability
# pstate(lower = c(0, -Inf), upper = c(45, 0.01), time = 1, model)
# 
# ## Density
# dstate(x = c(50, 0.03), time = 2, model) 
# dstate(x = rbind(c(50, 0.03), c(50, 0.1)), time = 2, model) # x is a matrix 
# 
# ## Quantile
# qstate(p = 0.5, s0 = model)
# 
# ## Generate random numbers
# object <- schwartz2f(alpha = 0.05)
# samples <- rstate(1000, time = 2, object)
# ## ...and plot histograms
# par(mfrow = c(2, 1))
# hist(samples[,1])
# abline(v = mean(object, time = 2)[1], col = "red")
# hist(samples[,2])
# abline(v = mean(object, time = 2)[2], col = "red")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.