# Consider correlation matrix of fitting parameters in TF1 before a fit

**URL:** <https://root-forum.cern.ch/t/consider-correlation-matrix-of-fitting-parameters-in-tf1-before-a-fit/50491>\
**Category:** Newbie\
**Created:** [June 21, 2022, 6:39am UTC](https://root-forum.cern.ch/t/consider-correlation-matrix-of-fitting-parameters-in-tf1-before-a-fit/50491 "2022-06-21T06:39:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nyx](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@Nyx](https://root-forum.cern.ch/u/Nyx)\
**Post date:** [June 21, 2022, 6:39am UTC](https://root-forum.cern.ch/t/consider-correlation-matrix-of-fitting-parameters-in-tf1-before-a-fit/50491/1 "2022-06-21T06:39:13Z")

</div>

I was wondering if it’s possible to include a known correlation matrix for certain fitting parameters before doing the fit. I have been reading other questions in the forum and read the documentation and I found how to get that matrix after the fit, but not how to implement it **before** the fit

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [June 21, 2022, 10:35am UTC](https://root-forum.cern.ch/t/consider-correlation-matrix-of-fitting-parameters-in-tf1-before-a-fit/50491/2 "2022-06-21T10:35:04Z")

</div>

Hi,  
We do not support directly in ROOT fitting a Graph (i.e. a set of points) which are correlated and you need to specify the correlation matrix.  
In this case you need to create your self the least-square function using the given correlation matrix and use the Fitter class. An example on how to use the Fitter class for unsigned a user provided objective function (chi2) is this tutorial, [line3dfit.C](https://root.cern.ch/doc/master/line3Dfit_8C.html)  
If you need further help in writing the chi2 function, please let me know

Best regards

Lorenzo
