vsolve {AssetPricing} | R Documentation |
Solve for expected value of assets.
Description
Solves a system of coupled differential equations for the expected
value of a number q
of (“perishable”) assets, with
q
running from 1
to qmax
, given a pricing
policy. Treats the system in a vectorized form and uses the method
of Runge-Kutta.
Usage
vsolve(S, lambda, gprob, tmax=NULL, x, nout=300,
alpha=NULL, salval=0, method="lsoda",verbInt=0)
Arguments
S |
An expression, or list of expressions, or a function or list
of functions, specifying the price sensitivity functions
|
lambda |
A function (of residual time |
gprob |
A function (to calculate probabilities) or a numeric vector of
probabilities determining the distribution of the size of
an arriving group of customers. Must be compatible with
certain characteristics of |
tmax |
The maximum residual time; think of this as being the initial
time at which the assets go on sale (with time decreasing
to zero, at which point the value of each asset drops to the
“salvage value” ( |
x |
An object of class |
nout |
The number of points at which values of the solution are to be
provided. These are taken to be equispaced on
[0, |
alpha |
A numeric scalar between 0 and 1 specifying the probability that an
arriving group of size |
salval |
A (non-negative) numeric scalar specifying the “salvage
value” of an asset — i.e. the quantity to which the value of an
asset drops at residual time |
method |
Character string specified the solution method to be used
by the differential equation solver |
verbInt |
A scalar value which controls “verbosity”.
If |
Details
The components of the argument S
may be provided either
as expressions or functions. If the former, these expressions
should be amenble to differentiation with respect to x
and t
via the function deriv3()
. This is
essentially a matter of convenience; the derivatives are not
actually used by vsolve
. The expressions are turned into
functions by deriv3()
in the same manner as is used by
xsolve()
. See the help for xsolve()
for further information about the required nature of S
.
The argument tmax
(if specified) must be less than or equal
to the tmax
attribute of argument S
if S
is a
piecewise linear price sensitivity function, and must also be less
than or equal to the tlim
attribute of argument x
.
If tmax
is not specified it will be set equal to the
tmax
attribute of argument S
if S
is a
piecewise linear price sensitivity function, in which case
this attribute must be less than or equal to the tlim
attribute of argument x
. (If this is not so then S
and x
are incompatible.) Otherwise tmax
will be
set equal to the tlim
attribute of argument x
.
The argument gprob
determines the range of possible values
of the size of an arriving group of customers. The maximum value
of this group size is in effect that value of j
for which
the corresponding probability value is numerically distinguishable
from zero. If the argument x
is a “doubly indexed”
list of functions (was created with type="dip"
) then
the maximum value of group size as determined by gprob
must be compatible with the indexing scheme of x
.
That is to say, it must be less than or equal to the jmax
attribute of x
, otherwise an error is given. Note that
if single indexing is in effect (i.e. x
was created with
type="sip"
) then this attribute is equal to 1, but for
single indexing x
does not depend on group size and so no
restriction is imposed.
Value
A list with components
x |
The argument |
v |
An object of class |
vdot |
An object of class |
Note
A substantial change was made to this package as of the change
of version number from 0.0-11 to 0.1-0. Previously the differential
equations which arise were solved via a “locally produced”
roll-your-own Runge-Kutta procedure. Now they are solved (in a
more sophisticated manner) using the package deSolve
. This
increases the solution speed by a factor of about 7. There will
be (minor, it is to be hoped) numerical differences in solutions
produced from the same input.
Author(s)
Rolf Turner r.turner@auckland.ac.nz http://www.stat.auckland.ac.nz/~rolf
References
P. K. Banerjee and T. R. Turner (2012). A flexible model for the pricing of perishable assets. Omega 40:5, 533–540. DOI https://doi.org/10.1016/j.omega.2011.10.001
Rolf Turner, Pradeep Banerjee and Rayomand Shahlori (2014). Optimal Asset Pricing. Journal of Statistical Software 58:11, 1–25. DOI https://doi.org/10.18637/jss.v058.i11
See Also
xsolve()
, plot.AssetPricing()
Examples
#
# In these examples "qmax" has been set equal to 5 which is
# an unrealistically low value for the total number of assets.
# This is done so as to reduce the time for package checking on CRAN.
#
S <- expression(exp(-kappa*x/(1+gamma*exp(-beta*t))))
attr(S,"parvec") <- c(kappa=10/1.5,gamma=9,beta=1)
lambda1 <- function(tt){
84*(1-tt)
}
# Optimal pricing policy assuming customers arrive singly:
X <- xsolve(S=S,lambda=lambda1,gprob=1,tmax=1,qmax=5)
lambda2 <- function(tt){
36*(1-tt)
}
# Expected values if the customers actually arrive in groups, using the
# (sub-optimal) pricing policy based on the (erroneous) assumption that
# they arrive singly. Note that the two scenarios are ``comparable'' in
# that the expected total number of customers is 42 in each case.
V <- vsolve(S=S,lambda=lambda2,gprob=(5:1)/15,x=X$x,alpha=0.5)