Convert time series arrays to functions of time and state
F = ts2func(Array)
F = ts2func(Array, 'Name1', Value1, 'Name2', Value2, ...)
The ts2func function encapsulates a time series array associated with a vector of real-valued observation times within a MATLAB® function suitable for Monte Carlo simulation of an NVARS-by-1 state vector Xt.
|Array||Time series array to encapsulate within a callable function of time and state. Array may be a vector, 2-dimensional matrix, or three-dimensional array.|
Specify optional input arguments as variable-length lists of matching parameter name/value pairs: 'Name1', Value1, 'Name2', Value2, ... and so on. The following rules apply when specifying parameter-name pairs:
Specify the parameter name as a character string, followed by its corresponding parameter value.
You can specify parameter name/value pairs in any order.
Parameter names are case insensitive.
You can specify unambiguous partial string matches.
Valid parameter names are:
Vector of monotonically increasing observation times associated with the time series input array Array. If you do not specify a value for this argument, Times is a zero-based, unit-increment vector of the same length as that of the dimension of Array associated with time (see TimeDimension).
Positive scalar integer that specifies which dimension of the input time series array Array is associated with time. The value of this argument cannot be greater than the number of dimensions of Array. If you do not specify a value for this argument, the default is 1, indicating that time is associated with the rows of Array.
Positive scalar integer that specifies which dimension of the input time series array Array is associated with the NVARS state variables. StateDimension cannot be greater than the number of dimensions of Array. If you do not specify a value for this argument, ts2func assigns StateDimension the first dimension of Array that is not already associated with time (the state vector Xt is associated with the first available dimension of Array not already assigned to TimeDimension).
|F||Callable function F(t) of a real-valued scalar observation time t. You can invoke F with a second input (such as an NVARS-by-1 state vector X), which is a placeholder that ts2func ignores. For example, while F(t) and F(t,X) produce identical results, the latter directly supports SDE simulation methods.|
When you specify Array as a trivial scalar or a vector (row or column), ts2func assumes that it represents a univariate time series.
F returns an array with one fewer dimension than the input time series array Array with which F is associated. Thus, when Array is a vector, a 2-dimensional matrix, or a three-dimensional array, F returns a scalar, vector, or 2-dimensional matrix, respectively.
When the scalar time t at which ts2func evaluates the function F does not coincide with an observation time in Times, F performs a zero-order-hold interpolation. The only exception is if t precedes the first element of Times, in which case F(t) = F(Times(1)).
To support Monte Carlo simulation methods, the output function F returns an NVARS-by-1 column vector or a 2-dimensional matrix with NVARS rows.
Ait-Sahalia, Y., "Testing Continuous-Time Models of the Spot Interest Rate," The Review of Financial Studies, Spring 1996, Vol. 9, No. 2, pp. 385–426.
Ait-Sahalia, Y., "Transition Densities for Interest Rate and Other Nonlinear Diffusions," The Journal of Finance, Vol. 54, No. 4, August 1999.
Glasserman, P., Monte Carlo Methods in Financial Engineering, New York: Springer-Verlag, 2004.
Hull, J. C., Options, Futures, and Other Derivatives, 5th ed. Englewood Cliffs, NJ: Prentice Hall, 2002.
Johnson, N. L., S. Kotz, and N. Balakrishnan, Continuous Univariate Distributions, Vol. 2, 2nd ed. New York: John Wiley & Sons, 1995.
Shreve, S. E., Stochastic Calculus for Finance II: Continuous-Time Models, New York: Springer-Verlag, 2004.