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 `S_j(x,t)`. See Details. `lambda` A function (of residual time `t` — see `tmax`) or a positive constant specifying the intensity of the (generally inhomogeneous) Poisson process of arrival times of groups of potential customers. `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 `s` (see below). See details. `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” (`salval`), usually `0`). The system of differential equations is solved over the time interval [0,`tmax`]. See Details. `x` An object of class `flap` (see `xsolve()`) specifying the (given) pricing policy. It has the form of a list of functions `x_i(t)`, with `i` running from 1 to `qmax` if `x` is “singly indexed”, i.e. not of class `di.flap` or `x_ij(t)`, with `i` running from 1 to `qmax` and `j` running from 1 to the maximum group size if `x` is “doubly indexed”, i.e. is of class `di.flap`. Note that `x` has (must have) an attribute `qmax` specifying the maximum number of assets available for sale, i.e. the number of assets available at the starting (residual) time `tmax`. `nout` The number of points at which values of the solution are to be provided. These are taken to be equispaced on [0,`tmax`]. `alpha` A numeric scalar between 0 and 1 specifying the probability that an arriving group of size `j > q` (where `q` is the number of assets remaining for sale) will consider purchasing (all of) these remaining assets. It is irrelevant (and defaults to 1 as a “place holder”) if customers always arrive singly. `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 `t=0`. Usually `salval` is equal to 0. `method` Character string specified the solution method to be used by the differential equation solver `ode`. There is a fairly large number of possible methods. See `ode()` for details. `verbInt` A scalar value which controls “verbosity”. If `verbInt > 0` then a “progress report” is printed every `verbInt` seconds (roughly). See `xsolve()` for a bit more detail.

### 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 `x` which was passed to `vsolve`, possibly with its `tlim` attribute modified. It is an object of class `flap`. `v` An object of class `flap` whose entries are (spline) functions `v_q(t)` specifying the expected value of `q` assets at time `t` as determined by numerically solving the coupled system of differential equations. `vdot` An object of class `flap` whose entries are the derivatives (with respect to `t`) of the functions `v_q(t)` described above. The values of these derivatives are determined as the left hand side of the differential equations being solved.

### 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.

### References

P. K. Banerjee, and T. R. Turner (2012). A flexible model for the pricing of perishable assets. Omega 40:5, 533–540, doi: 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. URL http://www.jstatsoft.org/v58/i11/. Baneree, P. K. and Turner, T. R.

### 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)
```

[Package AssetPricing version 1.0-1 Index]