QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
onefactorstudentcopula.hpp
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
24#ifndef quantlib_one_factor_student_copula_hpp
25#define quantlib_one_factor_student_copula_hpp
26
27#include <ql/experimental/credit/onefactorcopula.hpp>
28#include <ql/math/distributions/studenttdistribution.hpp>
29#include <ql/math/distributions/normaldistribution.hpp>
30
31namespace QuantLib {
32
34
54 public:
56 int nz, int nm,
57 Real maximum = 10, Size integrationSteps = 200);
58
59 Real density(Real m) const override;
60 Real cumulativeZ(Real z) const override;
61
62 private:
64 void performCalculations() const override;
65
67 CumulativeStudentDistribution cumulative_; // cumulated density of Z
68 int nz_; // degrees of freedom of Z
69 int nm_; // degrees of freedom of M
70
71 Real scaleM_; // scaling for m to ensure unit variance
72 Real scaleZ_; // scaling for z to ensure unit variance
73
74 // This function is used to update the table of the cumulative
75 // distribution of Y. It is invoked by performCalculations() when the
76 // correlation handle is amended.
78 };
79
81 return density_(m / scaleM_) / scaleM_;
82 }
83
85 return cumulative_(z / scaleZ_);
86 }
87
88
90
109 public:
111 int nz,
112 Real maximum = 10,
113 Size integrationSteps = 200);
114
115 Real density(Real m) const override;
116 Real cumulativeZ(Real z) const override;
117
118 private:
120 void performCalculations() const override;
121
124 int nz_; // degrees of freedom of Z
125
126 Real scaleZ_; // scaling for z to ensure unit variance
127
128 // This function is used to update the table of the cumulative
129 // distribution of Y. It is invoked by performCalculations() when the
130 // correlation handle is amended.
131 Real cumulativeYintegral (Real y) const;
132 };
133
135 return density_(m);
136 }
137
139 return cumulative_(z / scaleZ_);
140 }
141
142
144
162 public:
164 int nm,
165 Real maximum = 10,
166 Size integrationSteps = 200);
167
168 Real density(Real m) const override;
169 Real cumulativeZ(Real z) const override;
170
171 private:
173 void performCalculations() const override;
174
176 CumulativeNormalDistribution cumulative_; // cumulated density of Z
177 int nm_; // degrees of freedom of M
178
179 Real scaleM_; // scaling for m to ensure unit variance
180
181 // This function is used to update the table of the cumulative
182 // distribution of Y. It is invoked by performCalculations() when the
183 // correlation handle is amended.
184 Real cumulativeYintegral (Real y) const;
185 };
186
188 return density_(m / scaleM_) / scaleM_;
189 }
190
192 return cumulative_(z);
193 }
194
195}
196
197
198#endif
Cumulative normal distribution function.
Cumulative Student t-distribution.
Shared handle to an observable.
Definition: handle.hpp:41
Normal distribution function.
Abstract base class for one-factor copula models.
Real correlation() const
Single correlation parameter.
One-factor Gaussian-Student t-Copula.
void performCalculations() const override
Observer interface.
Real density(Real m) const override
Density function of M.
Real cumulativeZ(Real z) const override
Cumulative distribution of Z.
One-factor Double Student t-Copula.
void performCalculations() const override
Observer interface.
Real density(Real m) const override
Density function of M.
Real cumulativeZ(Real z) const override
Cumulative distribution of Z.
CumulativeStudentDistribution cumulative_
One-factor Student t - Gaussian Copula.
void performCalculations() const override
Observer interface.
Real density(Real m) const override
Density function of M.
Real cumulativeZ(Real z) const override
Cumulative distribution of Z.
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