%feature("docstring") OT::LinearModelFactory
"Class used to create a linear model from numerical samples.

**Available usages**:

    LinearModelFactory()

See Also
--------
LinearModel

Notes
-----
This class is used in order to create a linear model from numerical samples. The
linear regression model between the scalar variable :math:`Y` and the :math:`n`
-dimensional one :math:`\vect{X} = (X_i)_{i \leq n}` writes as follows:

.. math::

    \tilde{Y} = a_0 + \sum_{i=1}^n a_i X_i + \epsilon

where :math:`\epsilon` is the residual, supposed to follow the standard Normal
distribution.

Each coefficient :math:`a_i` is evaluated from both samples :math:`Ysample` and
:math:`Xsample` and is accompagnied by a confidence interval and a p-value (which
tests if they are significantly different from 0.0).

This class enables to test the quality of the model. It provides only numerical
tests. If :math:`X` is scalar, a graphical validation test exists, that draws
the residual couples :math:`(\epsilon_i, \epsilon_{i+1})`, where the residual
:math:`\epsilon_i` is evaluated on the samples :math:`(Xsample, Ysample)`:
:math:`\epsilon_i  = Ysample_i - \tilde{Y}_i` with
:math:`\tilde{Y}_i = a_0 + a_1 + Xsample_i`. The OpenTURNS method is 
:class:`~openturns.VisualTest_DrawLinearModelResidual`.
"

// ---------------------------------------------------------------------

%feature("docstring") OT::LinearModelFactory::build
"Build the linear model from numerical samples.

**Available usages**:

    build(*Xsample, Ysample*)

    build(*Xsample, Ysample, level*)

Parameters
----------
Xsample : 2-d sequence of float
    Input sample, of dimension :math:`n \geq 1`.
Ysample : 2-d sequence of float
    Output sample, of dimension 1.
level : positive float :math:`< 1`
    The level value of the confidence intervals of each coefficient of the
    linear model, equal to 0.95 by default.

Returns
-------
linearModel : :class:`~openturns.LinearModel`
    The linear model built from the samples :math:`(Xsample, Ysample)`:
    :math:`a_0 + \sum_{i=1}^n a_i X_i + \epsilon`, where :math:`\epsilon` is the
    random residual with zero mean.

See Also
--------
LinearModel


Examples
--------
>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Normal()
>>> Xsample = distribution.getSample(30)
>>> func = ot.SymbolicFunction(['x'], ['2 * x + 1'])
>>> Ysample = func(Xsample) + ot.Normal().getSample(30)
>>> LMF = ot.LinearModelFactory()
>>> linearModel = LMF.build(Xsample, Ysample)
>>> print(linearModel)
LinearModel name=Unnamed regression=[1.1802,2.0034] confidence intervals=[0.887852, 1.47256]
[1.70439, 2.3024] p-Values=[1.87486e-07,5.10531e-12]
"
