QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
onefactorgaussiancopula.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Roland Lichters
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file onefactorgaussiancopula.hpp
21 \brief One-factor Gaussian copula
22*/
23
24#ifndef quantlib_one_factor_gaussian_copula_hpp
25#define quantlib_one_factor_gaussian_copula_hpp
26
29
30namespace QuantLib {
31
32 //! One-factor Gaussian Copula
33 /*! The copula model
34 \f[ Y_i = a_i\,M+\sqrt{1-a_i^2}\:Z_i \f]
35 is specified here by setting the desnity function for all
36 variables, \f$ M, Z,\f$ and also \f$ Y \f$ to the standard
37 normal distribution
38 \f$ \phi(x) = \exp(-x^2/2) / \sqrt{2\pi}. \f$
39 */
41 public:
43 Real maximum = 5, Size integrationSteps = 50)
44 : OneFactorCopula (correlation, maximum, integrationSteps) {
46 }
47 Real density(Real m) const override;
48 Real cumulativeZ(Real z) const override;
49 /*! overrides the base class implementation based on table data */
50 Real cumulativeY(Real y) const override;
51 Real testCumulativeY (Real y) const;
52 /*! overrides the base class implementation based on table data */
53 Real inverseCumulativeY(Real p) const override;
54
55 private:
56 // nothing to be done when correlation changes
57 void performCalculations() const override {}
58
62 };
63
65 return density_(m);
66 }
67
69 return cumulative_(z);
70 }
71
73 return cumulative_(y);
74 }
75
77 return inverseCumulative_(p);
78 }
79
80}
81
82#endif
Cumulative normal distribution function.
Shared handle to an observable.
Definition: handle.hpp:41
Inverse cumulative normal distribution function.
Normal distribution function.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Abstract base class for one-factor copula models.
Real correlation() const
Single correlation parameter.
CumulativeNormalDistribution cumulative_
Real cumulativeY(Real y) const override
OneFactorGaussianCopula(const Handle< Quote > &correlation, Real maximum=5, Size integrationSteps=50)
Real density(Real m) const override
Density function of M.
Real cumulativeZ(Real z) const override
Cumulative distribution of Z.
Real inverseCumulativeY(Real p) const override
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
normal, cumulative and inverse cumulative distributions
One-factor copula base class.