simTermStructs
Simulate term structures for two-factor additive Gaussian interest-rate model
Syntax
Description
[
simulates future zero curve paths using a specified ZeroRates
,ForwardRates
] = simTermStructs(G2PP
,nPeriods
)LinearGaussian2F
object.
[
adds optional name-value pair arguments. ZeroRates
,ForwardRates
] = simTermStructs(___,Name,Value
)
Examples
Simulate Term Structures for the LinearGaussian2F Model
Create a two-factor additive Gaussian interest-rate model.
Settle = datetime(2007,12,15);
CurveTimes = [1:5 7 10 20]';
ZeroRates = [.01 .018 .024 .029 .033 .034 .035 .034]';
CurveDates = daysadd(Settle,360*CurveTimes,1);
irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates);
a = .07;
b = .5;
sigma = .01;
eta = .006;
rho = -.7;
G2PP = LinearGaussian2F(irdc,a,b,sigma,eta,rho)
G2PP = LinearGaussian2F with properties: ZeroCurve: [1x1 IRDataCurve] a: @(t,V)ina b: @(t,V)inb sigma: @(t,V)insigma eta: @(t,V)ineta rho: -0.7000
Use the simTermStructs
method to simulate term structures based on the LinearGaussian2F
model.
SimPaths = simTermStructs(G2PP, 10,'nTrials',100);
Simulate Term Structures for the LinearGaussian2F Model Using a Vector for deltaTime
Create a two-factor additive Gaussian interest-rate model.
Settle = datetime(2007,12,15);
CurveTimes = [1:5 7 10 20]';
ZeroRates = [.01 .018 .024 .029 .033 .034 .035 .034]';
CurveDates = daysadd(Settle,360*CurveTimes,1);
irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates);
a = .07;
b = .5;
sigma = .01;
eta = .006;
rho = -.7;
G2PP = LinearGaussian2F(irdc,a,b,sigma,eta,rho)
G2PP = LinearGaussian2F with properties: ZeroCurve: [1x1 IRDataCurve] a: @(t,V)ina b: @(t,V)inb sigma: @(t,V)insigma eta: @(t,V)ineta rho: -0.7000
Use the simTermStructs
method to simulate term structures based on the LinearGaussian2F
object, where uneven simulation tenors are specified using the optional name-value argument deltaTime
as a vector of length NPeriods
.
NPeriods = 10; dt = rand(NPeriods,1); SimPaths = G2PP.simTermStructs(NPeriods,'nTrials',100,'DeltaTime',dt);
Input Arguments
G2PP
— LinearGaussian2F
object
object
LinearGaussian2F
object, specified using the
G2PP
object created using LinearGaussian2F
.
Data Types: object
nPeriods
— Number of simulation periods
numeric
Number of simulation periods, specified as a numeric value. For example, to
simulate 12 years with an annual spacing, specify 12
as the
nPeriods
input and 1
as the optional
deltaTime
input (note that the default value for
deltaTime
is 1
).
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: [ZeroRates,ForwardRates] =
simTermStructs(G2PP,NPeriods,'nTrials',100,'deltaTime',dt)
deltaTime
— Time step between nPeriods
1
(default) | numeric
Time step between nPeriods
, specified as the
comma-separated pair consisting of 'deltaTime'
and a numeric scalar
or vector. For example, to simulate 12 years with an annual spacing, specify
12
as the nPeriods
input and
1
as the optional deltaTime
input (note that
the default value for deltaTime
is 1
).
Data Types: double
nTrials
— Number of simulated trials
1
(default) | positive integer
Number of simulated trials (sample paths), specified as the comma-separated pair
consisting of 'nTrials'
and a positive scalar integer value of
nPeriods
observations each. If you do not specify a value for
this argument, the default is 1
, indicating a single path of
correlated state variables.
Data Types: double
antithetic
— Flag indicating whether antithetic sampling is used to generate Gaussian random variates
false
(default) | positive integer
Flag indicating whether antithetic sampling is used to generate the Gaussian
random variates that drive the zero-drift, unit-variance rate Brownian vector
dW(t), specified as the comma-separated pair
consisting of 'antithetic'
and a Boolean scalar flag. For details,
see simBySolution
for the HWV model.
Data Types: logical
Z
— Direct specification of dependent random noise process
Gaussian variates generated by simBySolution
function (default) | numeric
Direct specification of the dependent random noise process, specified as the
comma-separated pair consisting of 'Z'
and a numeric value. The
Z
value is used to generate the zero-drift, unit-variance rate
Brownian vector dW(t) that drives the
simulation. For details, see simBySolution
for the HWV model. If you do not specify a value for
Z
, simBySolution
generates Gaussian
variates.
Data Types: double
Tenor
— Maturities to compute at each time step
tenor of LinearGaussian2F
object zero
curve (default) | numeric vector
Maturities to compute at each time step, specified as the comma-separated pair
consisting of 'Tenor'
and a numeric vector.
Tenor
enables you to choose a different set of rates to output
than the underlying rates. For example, you may want to simulate quarterly data but
only report annual rates; this can be done by specifying the optional input
Tenor
.
Data Types: double
Output Arguments
ZeroRates
— Simulated zero-rate term structures
matrix
Simulated zero-rate term structures, returned as a
nPeriods+1
-by-nTenors
-by-nTrials
matrix.
ForwardRates
— Simulated forward-rate term structures
matrix
Simulated zero-rate term structures, returned as a
nPeriods+1
-by-nTenors
-by-nTrials
matrix. The ForwardRates
output is computed using the simulated
short rates and by using the model definition to recover the entire yield curve at
each simulation date.
Version History
Introduced in R2013a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)