# Financial model calibration - model fitting

I need to calibrate a model which has the following explicit form:

$$\ P(T) = 100 \ [C^{(r)}]^{2c^{(r)}b^{(r)}/(σ^{(r)})^{2}}\ [C^{(b)}]^{2c^{(b)}b^{(b)}/(σ^{(b)})^{2}}\ e^{-A^{(r)}r_0-A^{(b)}b_0} e^{-∫_0^{T}ρ[1-∫_0^{∞}∫_0^{∞}e^{-A^{(r)}(s)y^{(r)}-A^{(b)}(s)y^{(b)}}dC(F_r(y^{(r)}),F_{b}(y^{(b)}))]ds}$$

I would like to obtain the values of parameters that minimize the squared difference between my observed value (say 107.41) and the value given by the model. This is what I have done so far in terms of programming:

(** Defining expressions A and C **)
Ar[γr_, τ_] := (2 γr (1 - Exp[-τ] Sqrt[(cr ar)^2 + 2 (σr γr)^2]]) + αr (Sqrt[(cr ar)^2
+ 2 (σr γr)^2] + cr ar + Exp[-τ Sqrt[(cr ar)^2 + 2 (σr γr)^2]] (Sqrt[(cr ar)^2 + 2 (σr γr)^2]
- cr ar)))/(αr σr^2 (1 - Exp[-τ Sqrt[(cr ar)^2 + 2 (σr γr)^2]]) + (Sqrt[(cr ar)^2 + 2 (σr γr)^2] - cr ar)
+ (Sqrt[(cr ar)^2 + 2 (σr γr)^2] + cr ar) Exp[-τ Sqrt[(cr ar)^2 + 2 (σr γr)^2]]);

Ab[γb_, τ_] := (2 γb (1 - Exp[-τ] Sqrt[(cb ab)^2 + 2 (σb γb)^2]]) + αb (Sqrt[(cb ab)^2
+ 2 (σb γb)^2] + cb ab + Exp[-τ Sqrt[(cb ab)^2 + 2 (σb γb)^2]] (Sqrt[(cb ab)^2 + 2 (σb γb)^2]
- cb ab)))/(αb σb^2 (1 - Exp[-τ Sqrt[(cb ab)^2 + 2 (σb γb)^2]]) + (Sqrt[(cb ab)^2 + 2 (σb γb)^2] - cb ab)
+ (Sqrt[(cr ab)^2 + 2 (σb γb)^2] + cb ab) Exp[-τ Sqrt[(cb ab)^2 + 2 (σb γb)^2]]);

Cr[γr_, τ_] := ((2 Sqrt[(cr ar)^2 + 2 (σr γr)^2] Exp[-((Sqrt[(cr ar)^2 + 2 (σr γr)^2]
+ cr ar)/2) τ])/(αb γb^2 (1 - Exp[-τ Sqrt[(cb ab)^2 + 2 (σr γr)^2]]) + (Sqrt[(cr ar)^2
+ 2 (σr γr)^2] - cr ar) + (Sqrt[(cr ar)^2 + 2 (σr γr)^2] + cr ar) Exp[-τ Sqrt[(cr ar)^2
+ 2 (σr γr)^2]]))^((2 cr br)/σr^2);

Cb[γb_, τ_] := ((2 Sqrt[(cb ab)^2 + 2 (σb γb)^2] Exp[-((Sqrt[(cb ab)^2 + 2 (σb γb)^2]
+ cb ab)/2) τ])/(αb γb^2 (1 - Exp[-τ Sqrt[(cb ab)^2 + 2 (σb γb)^2]]) + (Sqrt[(cb ab)^2
+ 2 (σb γb)^2] - cb ab) + (Sqrt[(cb ab)^2 + 2 (σb γb)^2] + cb ab) Exp[-τ Sqrt[(cb ab)^2
+ 2 (σb γb)^2]]))^((2 cb bb)/σb^2);

(** Define copula - Dependence structure between bond issuer's intensity and short rate **)
PDF[CopulaDistribution[{"FGM", θ}, {ExponentialDistribution[α], ExponentialDistribution[β]}], {x, y}];

(** Define expressions **)
αr = 0; αb = 0; t = 2.168;
BondPrice = (Cb[1, t] Cr[1, t] Exp[-Ab[1, t] b0 - Ar[1, t] r0 - ρ t + ρ NIntegrate[Exp[-As[1, τ] x - Ar[1, τ] y]
PDF[CopulaDistribution[{"FGM", θ}, {ExponentialDistribution[α], ExponentialDistribution[β]}], {x, y}], {x, 0, ∞}, {y, 0, ∞}, {τ, 0,t}]] - 107.41)^2

(** Minimizing the squared difference of model price and market price **)
NMinimize[{BondPrice, -1 <= θ <= 1}, {cr, cb, ab, ar, br, bb, σr, σb, r0, b0, θ, ρ, α, β}]


The following is the error obtained upon execution:

NIntegrate::inumr: The integrand XXXXX has evaluated to non-numerical values for all sampling points in the region with boundaries  {{∞,0.},{∞,0.},{0,2.168}}.>>


My questions are:

1. Is NMinimize the correct routine to use?
2. If it is correct, how do I include multiple constraints? So far I put only 1 constraint, i.e. -1 <= θ <= 1
3. How do I rewrite the fitting procedure if I have multiple prices to calibrate?
-
Did you try evaluating BondPrice for a few values of the variables and parameters? If so, did it return real values? –  Sjoerd C. de Vries Jul 3 at 7:37
@SNMRamli Could you please post any link/reference to the original model? –  Rod Jul 3 at 12:30
@SNMRamli I believe what you're trying is not going to work... Instead of NMinimize[] you should take a look at FindDistributionParameters[] first... some variables you're trying to find in the minimization problem are actually parameters of the CopulaDistribution[]. So you have to estimate them, instead of "solve" them trhough a minimization problem... –  Rod Jul 3 at 13:07