27#ifndef quantlib_linear_least_squares_regression_hpp
28#define quantlib_linear_least_squares_regression_hpp
38 template <
class Container>
52 template <
class xContainer,
bool>
71 template <
class xContainer>
78 Size m = x.begin()->size();
79 for (
Size i = 0; i < m; ++i)
94 template <
class xContainer,
class yContainer>
96 const yContainer&
y,
Real intercept = 1.0);
98 template <
class xContainer,
class yContainer,
class vContainer>
100 const yContainer&
y,
const vContainer &
v);
104 template <
class xContainer,
class yContainer>
inline
106 const yContainer&
y,
Real intercept)
108 details::LinearFcts<xContainer,
109 std::is_arithmetic<typename xContainer::value_type>::value>
110 (x, intercept).fcts()) {
113 template <
class xContainer,
class yContainer,
class vContainer>
inline
123 template <
class ArgumentType = Real>
127 const std::vector<ArgumentType> & x,
128 const std::vector<Real> &
y,
129 const std::vector<ext::function<
Real(ArgumentType)> > &
v)
general linear least squares regression
LinearLeastSquaresRegression(const std::vector< ArgumentType > &x, const std::vector< Real > &y, const std::vector< ext::function< Real(ArgumentType)> > &v)
LinearRegression(const xContainer &x, const yContainer &y, Real intercept=1.0)
linear regression y_i = a_0 + a_1*x_0 +..+a_n*x_{n-1} + eps
Real operator()(const Container &x) const
xContainer::value_type ArgumentType
LinearFcts(const xContainer &x, Real intercept)
std::vector< ext::function< Real(ArgumentType)> > v
const std::vector< ext::function< Real(ArgumentType)> > & fcts()
xContainer::value_type ArgumentType
LinearFcts(const xContainer &x, Real intercept)
std::vector< ext::function< Real(ArgumentType)> > v
const std::vector< ext::function< Real(ArgumentType)> > & fcts()
Maps function, bind and cref to either the boost or std implementation.
general linear least square regression
std::size_t Size
size of a container
ext::shared_ptr< BlackVolTermStructure > v