# How to perform least square and modified least square fit using ROOT?

**URL:** <https://root-forum.cern.ch/t/how-to-perform-least-square-and-modified-least-square-fit-using-root/52956>\
**Category:** ROOT\
**Tags:** root\
**Created:** [January 1, 2023, 2:23am UTC](https://root-forum.cern.ch/t/how-to-perform-least-square-and-modified-least-square-fit-using-root/52956 "2023-01-01T02:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![realTay\_John](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/87869e/32.png) [@realTay\_John](https://root-forum.cern.ch/u/realTay_John)\
**Post date:** [January 1, 2023, 2:23am UTC](https://root-forum.cern.ch/t/how-to-perform-least-square-and-modified-least-square-fit-using-root/52956/1 "2023-01-01T02:23:22Z")

</div>

Hi experts,  
Here is the definition of Least square and modified least square.  
How to perform them respectively, or if there is some options could be used to realise them?  
Thank you.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/2/c/2c216acb4c364f6a42845427812b854da7ab497b.png)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 1, 2023, 7:54am UTC](https://root-forum.cern.ch/t/how-to-perform-least-square-and-modified-least-square-fit-using-root/52956/2 "2023-01-01T07:54:58Z")

</div>

Search for “`Neyman`”, “`Pearson`”, and “`Baker`” (or “`Cousins`”) `chi-square` in the [TH1 Class Reference](https://root.cern/doc/master/classTH1.html) (and/or elsewhere).

See also:

> [@Chi-square definition in ROOT](https://root-forum.cern.ch/t/chi-square-definition-in-root/51083):
>
> Hi All, My co-worker and I, using different tools, were trying to fit some histograms. Surprisingly, we found the chi2 of our results were different by 1.5 to 2 times. Here is a toy histogram for example: Bin centres: [0.025, 0.075, 0.125, 0.175, 0.225, 0.275, 0.325, 0.375, 0.425, 0.475, 0.525, 0.575, 0.625, 0.675, 0.725, 0.775, 0.825, 0.875, 0.925, 0.975] Bin edges: [0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.] Bin heights: […

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [January 15, 2023, 7:55am UTC](https://root-forum.cern.ch/t/how-to-perform-least-square-and-modified-least-square-fit-using-root/52956/3 "2023-01-15T07:55:18Z")

</div>

Closed on January 15, 2023, 7:55am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
