.. note::
    :class: sphx-glr-download-link-note

    Click :ref:`here <sphx_glr_download_examples_documentation_confidence_basic.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_documentation_confidence_basic.py:


doc_confidence_basic.py
=======================




.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    [[Variables]]
        a:  0.09943896 +/- 1.9322e-04 (0.19%) (init = 0.1)
        b:  1.98476942 +/- 0.01222678 (0.62%) (init = 1)
    [[Correlations]] (unreported correlations are < 0.100)
        C(a, b) =  0.601
          99.73%    95.45%    68.27%    _BEST_    68.27%    95.45%    99.73%
     a:  -0.00059  -0.00039  -0.00019   0.09944  +0.00019  +0.00039  +0.00060
     b:  -0.03766  -0.02478  -0.01230   1.98477  +0.01230  +0.02478  +0.03761





|


.. code-block:: default

    ##
    import warnings
    warnings.filterwarnings("ignore")
    ##
    # <examples/doc_confidence_basic.py>
    import numpy as np

    import lmfit

    x = np.linspace(0.3, 10, 100)
    np.random.seed(0)
    y = 1/(0.1*x) + 2 + 0.1*np.random.randn(x.size)

    pars = lmfit.Parameters()
    pars.add_many(('a', 0.1), ('b', 1))


    def residual(p):
        return 1/(p['a']*x) + p['b'] - y


    mini = lmfit.Minimizer(residual, pars)
    result = mini.minimize()

    print(lmfit.fit_report(result.params))

    ci = lmfit.conf_interval(mini, result)
    lmfit.printfuncs.report_ci(ci)
    # <end examples/doc_confidence_basic.py>


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.406 seconds)


.. _sphx_glr_download_examples_documentation_confidence_basic.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download

     :download:`Download Python source code: confidence_basic.py <confidence_basic.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: confidence_basic.ipynb <confidence_basic.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
