# Question about the scaling factor in ROOT’s weighted Poisson log-likelihood (WLS fit)

**URL:** <https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952>\
**Category:** Roofit and RooStats\
**Created:** [July 22, 2026, 6:18pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952 "2026-07-22T18:18:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Byungchul\_Yu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/byungchul_yu/32/31421_2.png) [@Byungchul\_Yu](https://root-forum.cern.ch/u/Byungchul_Yu)\
**Post date:** [July 22, 2026, 6:18pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/1 "2026-07-22T18:18:36Z")

</div>

Hi ROOT experts,

I have been studying the implementation of the weighted log-likelihood fit (“WL” option) in ROOT (v6.36.04), and I would like to understand the statistical motivation behind one part of the implementation.

From the source code, ROOT defines the effective scaling factor as

s\_i = sigma\_i^2 / y\_i

and

n\_eff = y\_i / s\_i = y\_i^2 / sigma\_i^2  
mu\_eff = mu\_i / s\_i

which gives

l\_i = s\_i \* [n\_eff \* log(n\_eff / mu\_eff) + mu\_eff - n\_eff]

I have independently implemented this expression and verified numerically that it reproduces ROOT’s MinFCN exactly for my weighted histogram fits.

While studying this implementation, I became curious about the role of the final scaling factor.

Once the effective quantities are defined as

n\_eff = y\_i / s\_i  
mu\_eff = mu\_i / s\_i

it seems natural to consider the effective Poisson deviance

l\_i = n\_eff \* log(n\_eff / mu\_eff) + mu\_eff - n\_eff by itself.

However, ROOT instead minimizes

l\_i = s\_i \* [n\_eff \* log(n\_eff / mu\_eff) + mu\_eff - n\_eff]

While studying this implementation, I became curious about the role of the final scaling factor.

The effective count formalism is also discussed in the paper G. Böhm and G. Zech, _Statistics of weighted Poisson events and its applications_.

In a section on the Scaled Poisson Distribution (SPD), it is introduced for parameter estimation, where the effective quantities are defined in essentially the same way as in ROOT.

However, the likelihood in the paper does not appear to include the additional scaling factor s\_i that multiplies the effective Poisson deviance.

So my question is:

**Why does ROOT include the final scaling factor `s_i`?**

1. **If the effective quantities (`n_eff` and `mu_eff`) are already introduced, why is the effective Poisson deviance by itself not sufficient?**

2. **Would omitting the factor `s_i` lead to an incorrect likelihood or estimator? If so, could you explain what statistical property would be lost?**

If there is a derivation, technical note, or publication explaining the origin of this factor, I would greatly appreciate a reference.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [July 23, 2026, 11:51am UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/2 "2026-07-23T11:51:49Z")

</div>

tagging @jonas @StephanH

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [July 23, 2026, 12:14pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/3 "2026-07-23T12:14:37Z")

</div>

I saw it, but I haven’t found the source code yet. 😅

@Byungchul_Yu which code are you talking about specifically? There’s at least three places that deal with Poisson likelihoods.

---

<div class="post-metadata">

**Author:** ![Byungchul\_Yu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/byungchul_yu/32/31421_2.png) [@Byungchul\_Yu](https://root-forum.cern.ch/u/Byungchul_Yu)\
**Post date:** [July 31, 2026, 5:18pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/4 "2026-07-31T17:18:30Z")

</div>

Thanks! @StephanH I’m referring to the same implementation discussed in this earlier ROOT Forum thread:

[https://root-forum.cern.ch/t/weighted-log-likelihood-estimation-for-low-statistics-binned-histogram/58191](https://root-forum.cern.ch/t/weighted-log-likelihood-estimation-for-low-statistics-binned-histogram/58191)

@moneta Lorenzo’s reply there includes the relevant source code and a detailed explanation of how the weighted likelihood is implemented. My current question is a follow-up to that discussion: I understand how ROOT evaluates the expression numerically, but I’m trying to understand the statistical motivation for the scaling factor.

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [August 4, 2026, 1:59pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/5 "2026-08-04T13:59:54Z")

</div>

Hello @Byungchul_Yu ,

@jonas and me had a look, but for the moment, we can’t explain the factor. Jonas will check more in the coming days.

---

<div class="post-metadata">

**Author:** ![Byungchul\_Yu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/byungchul_yu/32/31421_2.png) [@Byungchul\_Yu](https://root-forum.cern.ch/u/Byungchul_Yu)\
**Post date:** [August 15, 2026, 5:51pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/6 "2026-08-15T17:51:30Z")

</div>

Hi @jonas, @moneta and @StephanH,

Just following up on this, as the topic will close automatically soon.  
Have you had a chance to look into the statistical motivation behind the scaling factor s\_i?  
Any updates or insights would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Ako\_b](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Post date:** [August 27, 2026, 1:43am UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/7 "2026-08-27T01:43:51Z")

</div>

Hello, @Byungchul_Yu !

I took a closer look at the implementation of `TH1::Fit` method when option `"WL"` is specified.  
The relevant code is inside [`ROOT::Fit::FitUtil::EvaluatePoissonLogL`](https://github.com/root-project/root/blob/138a77b57a19c8b25be565151168db4ed6321a4f/math/mathcore/src/FitUtil.cxx#L1565).  
I will try to address your questions.

### Math derivation

Firstly, let’s map variables from the code to analytical quantities using your designations.

```cpp
// FitUtil.cxx

// bin content: y_i = sum w
auto y = *data.ValuePtr(i);

// model prediction: mu_i
fval = func(x, p);

// standard deviation: sigma_i = sqrt(sum w^2)
double error = data.Error(i); 

// effective weight or scale factor: s_i = sigma_i^2 / y_i
weight = (error * error) / y;

```

Following Böhm & Zech, a weighted bin content Y\_i distribution can be modeled via a Scaled Poisson Distribution (SPD):

Y\_i = s\_{i, \text{true}} X\_i, \, X\_i \sim \text{Pois}(n\_\text{eff,true})

where bin statistics are

y\_i = \sum\_{j} w\_j, \quad \sigma\_i^2 = \sum\_{j} w\_j^2

The estimated effective parameters are:

s\_i = \frac{\sigma\_i^2}{y\_i},\quad n\_\text{eff} = \frac{y\_i^2}{\sigma\_i^2} = \frac{y\_i}{s\_i},\quad \mu\_\text{eff} = \frac{\mu\_i}{s\_i}

where \mu\_i is model prediction for bin content.

The effective Poisson log-likelihood (dropping factorial term) is

l(\mu\_\text{eff} \mid n\_\text{eff}) = n\_\text{eff} \log(\mu\_\text{eff}) - \mu\_\text{eff}

The Poisson deviance is

\Delta l = l(n\_\text{eff} \mid n\_\text{eff}) - l(\mu\_\text{eff} \mid n\_\text{eff}) = n\_\text{eff} \log\frac{n\_\text{eff}}{\mu\_\text{eff}} - n\_\text{eff} + \mu\_\text{eff}

We can factor out s\_i^{-1} by substituting back n\_\text{eff} = y\_i/s\_i,\, \mu\_\text{eff} = \mu\_i/s\_i

\begin{align\*} \Delta l &= \frac{y\_i}{s\_i} \log\frac{y\_i}{\mu\_i} - \frac{y\_i}{s\_i} + \frac{\mu\_i}{s\_i} =\\ &= \frac{1}{s\_i} \times \left( -y\_i \log\frac{\mu\_i}{y\_i} + \mu\_i - y\_i \right) \end{align\*}

Now compare to `ROOT::Fit::FitUtil::EvaluatePoissonLogL` implementation:

```cpp
// FitUtil.cxx
// parts of log-likelihood calculation
nloglike -= weight * y * ( ROOT::Math::Util::EvalLog(fval/y) );
nloglike += weight * ( fval - y);

```

Since \mathtt{weight} = s\_i, ROOT computes

\Delta l\_\text{ROOT} = s\_i \times \left( -y\_i \log\frac{\mu\_i}{y\_i} + \mu\_i - y\_i \right)

In the limit (y\_i - \mu\_i) \ll \mu\_i the correct deviance yields weighted Pearson’s \chi^2:

\Delta l \approx s\_i^{-1} \left( -y\_i \left(- \frac{y\_i - \mu\_i}{\mu\_i} \right ) + \mu\_i - y\_i \right) = \frac{y\_i}{\sigma\_i^2} \times \frac{(y\_i - \mu\_i)^2}{\mu\_i} \approx \frac{(y\_i - \mu\_i)^2}{\sigma\_i^2}

For ROOT’s implementation, the limit becomes

\Delta l\_\text{ROOT} \approx \frac{\sigma\_i^2}{y\_i} \times \frac{(y\_i - \mu\_i)^2}{\mu\_i}

This inverts statistical weights: for example, large effective weights (s\_i \> 1) indicate overdispersion compared to Poisson distribution.  
Such bins should have a reduced impact on objective function to minimize, but instead it is amplified.

### Addressing questions

To sum up, regarding your first question, effective Poisson deviance is sufficient.

Regarding your second question, dropping s\_i^{-1} factor (not s\_i) yields basic Poisson deviance which disregards the variance of the weights inside bin.  
It will produce biased point estimates with increased variance.  
Also it will likely underestimate or overestimate error bounds if s\_i \> 1 or s\_i \< 1 over all bins.  
Notably, I see that ROOT applies sandwich correction to covariance matrix in [`Fitter::ApplyWeightCorrection`](https://github.com/root-project/root/blob/138a77b57a19c8b25be565151168db4ed6321a4f/math/mathcore/src/Fitter.cxx#L945) which fixes error bounds, but this doesn’t fix bias and increased variance of point estimates.

### Possible bug

@StephanH and @jonas ,  
I suspect that in the implementation inside [`ROOT::Fit::FitUtil::EvaluatePoissonLogL`](https://github.com/root-project/root/blob/138a77b57a19c8b25be565151168db4ed6321a4f/math/mathcore/src/FitUtil.cxx#L1565) might be wrong.  
Instead of

```cpp
// FitUtil.cxx
// parts of log-likelihood calculation
nloglike -= weight * y * ( ROOT::Math::Util::EvalLog(fval/y) );
nloglike += weight * ( fval - y);

```

it should be

```cpp
// FitUtil.cxx
// parts of log-likelihood calculation
nloglike -= (1.0/weight) * y * ( ROOT::Math::Util::EvalLog(fval/y) );
nloglike += (1.0/weight) * ( fval - y);

```

This behavior with multiplying log-likelihood with wrong prefactor appears both in v6.34.04 and v6.40.02.  
If this is truly unintended, it might seriously affect fit convergence and quality in case of large weight variances inside bins.  
Please let me know if I am missing something important in ROOT’s implementation.

---

<div class="post-metadata">

**Author:** ![Ako\_b](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Post date:** [August 27, 2026, 10:31am UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/8 "2026-08-27T10:31:58Z")

</div>

For a reference, I suggest looking there:

> **[Fitting weighted histograms — iminuit 2.32.0 compiled with...](https://scikit-hep.org/iminuit/notebooks/weighted_histograms.html)**

Important: in the link they define scaling factor differently:

s\_\text{scikit} = \frac{\sum w}{\sum w^2}

while convention in this topic is

s = \frac{\sum w^2}{\sum w}

> [@Byungchul\_Yu](#):
>
> s\_i = sigma\_i^2 / y\_i

---

<div class="post-metadata">

**Author:** ![Byungchul\_Yu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/byungchul_yu/32/31421_2.png) [@Byungchul\_Yu](https://root-forum.cern.ch/u/Byungchul_Yu)\
**Post date:** [September 7, 2026, 7:28pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/9 "2026-09-07T19:28:48Z")

</div>

Hi @Ako_b,

Thank you very much for your detailed response. In particular, you addressed exactly the second point I was trying to understand in my original question, and I really appreciate you bringing @moneta, @StephanH, and @jonas into the discussion to help clarify the ROOT implementation.

Before going further, I would like to make sure that I am following the notation used in your reply. Using the notation from my original post, at this point we define

s\_i = \frac{\sigma\_i^2}{y\_i} = \frac{\sum\_j w\_j^2}{\sum\_j w\_j}.

I am currently using ROOT v6.30.02. To understand exactly what the `WL` option was doing in my analysis, I independently reconstructed the MinFCN bin by bin using

n\_{\mathrm{eff},i} = \frac{y\_i}{s\_i} = \frac{y\_i^2}{\sigma\_i^2},

and

\mu\_{\mathrm{eff},i} = \frac{\mu\_i}{s\_i}.

For each bin, I reproduced the ROOT `WL` contribution to the MinFCN using

s\_i \left[n\_{\mathrm{eff},i} \ln \left( \frac{n\_{\mathrm{eff},i}} {\mu\_{\mathrm{eff},i}} \right) + \mu\_{\mathrm{eff},i} - n\_{\mathrm{eff},i} \right] = s\_i \, \Delta\ell\_i^{\mathrm{SPD}}.

Numerically, summing these bin contributions reproduces the MinFCN returned by the ROOT `WL` fit in my v6.30.02 setup.

However, since the quantity in the brackets is

n\_{\mathrm{eff},i} \ln \left( \frac{n\_{\mathrm{eff},i}} {\mu\_{\mathrm{eff},i}} \right) + \mu\_{\mathrm{eff},i} - n\_{\mathrm{eff},i} = \Delta\ell\_i^{\mathrm{SPD}} = \frac{1}{s\_i} \Delta\ell\_i^{\mathrm{Poisson}},

the additional factor of s\_i outside the brackets cancels the 1/s\_i factor already contained inside the brackets, giving

s\_i \, \Delta\ell\_i^{\mathrm{SPD}} = \Delta\ell\_i^{\mathrm{Poisson}}.

This was exactly the part that motivated my second question: if the 1/s\_i dependence carries the information about the variance of the weights in each bin, I could not understand why the additional s\_i factor should cancel it.

From your response, my understanding is that this cancellation should not occur if the goal is to use the scaled-Poisson approximation.

I also noticed what appears to be an additional complication when comparing ROOT versions. Based on the discussion so far, my understanding is:

- ROOT v6.30.02, which I am currently using: the implementation I reproduced is effectively

- ROOT v6.34.04 and v6.40.02, based on your inspection: the implementation appears instead to evaluate

If I am understanding all of this correctly, it seems that the behavior of the `WL` option may have changed between ROOT versions, and both implementations appear to differ from the scaled-Poisson prescription discussed above.

So I would really appreciate clarification on the following single point:

- **If the scaled-Poisson deviance is sufficient by itself, then no additional prefactor of s\_i should be multiplied in front of it. Is there a ROOT version in which the `WL` method is implemented in this way, with the scaled-Poisson deviance used directly, and with the parameter uncertainties/covariance also calculated consistently?**

Thank you again for looking into this and for helping clarify the issue.

With warm regards,  
Byungchul Yu

---

<div class="post-metadata">

**Author:** ![Byungchul\_Yu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/byungchul_yu/32/31421_2.png) [@Byungchul\_Yu](https://root-forum.cern.ch/u/Byungchul_Yu)\
**Post date:** [September 14, 2026, 1:13pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/10 "2026-09-14T13:13:05Z")

</div>

Hi @Ako_b, @moneta, @StephanH, @jonas

I’m just following up on my previous message regarding the implementation of the `WL` option across different ROOT versions.

To recap briefly, I’m trying to confirm whether there is a specific ROOT version where the scaled-Poisson deviance is used directly (without the extra prefactor s\_i canceling or multiplying it), along with consistent calculation of parameter uncertainties and the covariance matrix.

I completely understand that everyone is busy, but any clarification or guidance on this point when you have a moment would be greatly appreciated!

Thank you again for your time and help.

Byungchul Yu

---

<div class="post-metadata">

**Author:** ![Ako\_b](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Post date:** [September 15, 2026, 12:30pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/11 "2026-09-15T12:30:26Z")

</div>

Hi, @Byungchul_Yu !

Regarding ROOT versions, it seems that the log-likelihood evaluation code is the same for versions from v6.30.02 to 6.40.02.

To get definitive results, I’ve decided to run a small numerical experiment.

### Theoretical setup

Consider a histogram with two bins and a model predicting mean number of events in each bin \mu.

Fix true value \mu\_0.  
First bin gets number of events

y\_1 \sim \mathrm{Poisson}(\mu\_0).

Model prediction for the first bin is \mu.

Fix true value of a scale factor s\_0.  
The second bin gets weighted number of events

y\_2 \sim \mathrm{Poisson}(\mu\_0/s\_0) \times s\_0.

In case of 0 \< s\_0 \< 1 the second bin will get larger amount of events \mu\_0/s\_0 with small weights s\_0.  
Note that model prediction for mean number of events for the second bin is \mu too.

Let’s denote objective function D to minimize for this problem as

D = k\_1 \, \Delta\ell\_1^{\mathrm{Poisson}} + k\_2 \, \Delta\ell\_2^{\mathrm{Poisson}}

where k\_i are arbitrary weights.

Estimator for \mu is

\hat{\mu} = \mathrm{argmin}\,D(\mu)

Let’s derive it assuming that y\_i are large enough to not hit parameter boundary \mu = 0:

\begin{align} \frac{d}{d\mu}D(\mu) &= \frac{d}{d\mu} \sum\_i k\_i \Delta\ell\_i^{\mathrm{Poisson}} = \\ &= \frac{d}{d\mu} \sum\_i k\_i \left( -y\_i \log\frac{\mu}{y\_i} + \mu - y\_i \right) = \\ &= \sum\_i k\_i \left( -\frac{y\_i}{\mu} + 1 \right) = 0 \end{align}

From there it follows that

\hat{\mu} = \frac{\sum\_i k\_i y\_i}{\sum\_i k\_i}

which is greater than zero under assumption that y\_i \> 0.

Natural choices for k\_i as a function of s\_i = \frac{\sigma\_i^2}{y\_i} from this topic are limited to

k\_i = \begin{cases} s\_i, & \text{apparent from ROOT source code} \\ 1, & \text{Poisson likelihood} \\ \frac{1}{s\_i}, & \text{Scaled Poisson likelihood} \end{cases}

### Theoretical Estimator Performance

Note that by definition of how y\_i are generated s\_i are constant

s\_1 = \frac{\sigma\_1^2}{y\_1} = \frac{\sum\_{j=1}^{j=y\_1} 1}{\sum\_{j=1}^{j=y\_1} 1} = 1,

s\_2 = \frac{\sigma\_2^2}{y\_2} = \frac{\sum\_{j=1}^{j=y\_2} s\_0^2}{\sum\_{j=1}^{j=y\_2} s\_0} = s\_0,

and hence k\_i = \text{const}

Taking expectation and variance of estimator, we get

\mathrm{E}\hat{\mu} = \frac{k\_1 \mathrm{E}y\_1 + k\_2 \mathrm{E}y\_2}{k\_1 + k\_2} = \frac{k\_1 \mu\_0 + k\_2 \mu\_0/s\_0 \times s\_0}{k\_1 + k\_2} = \mu\_0

\mathrm{Var}\,\hat{\mu} = \frac{k\_1^2 \mathrm{Var}\,y\_1 + k\_2^2 \mathrm{Var}\,y\_2}{(k\_1 + k\_2)^2} = \frac{k\_1^2 \mu\_0 + k\_2^2 \mu\_0/s\_0 \times s\_0^2}{(k\_1 + k\_2)^2} = \mu\_0 \frac{k\_1^2 + k\_2^2 s\_0}{(k\_1 + k\_2)^2}

We see that all estimators are unbiased, and choice of k\_i affects only variance.

\mathrm{Var}\,\hat{\mu} = \mu\_0 \times \begin{cases} \frac{1 + s\_0^3}{(1 + s\_0)^2}, & \text{ROOT source code} \\ \frac{1 + s\_0}{4}, & \text{Poisson deviance} \\ \frac{s\_0}{1 + s\_0}, & \text{Scaled Poisson deviance} \end{cases}

It can be shown that for s\_0 \> -1

\frac{s\_0}{1 + s\_0} \< \frac{1 + s\_0}{4} \< \frac{1 + s\_0^3}{(1 + s\_0)^2}

From another perspective, just by summing all events without weights we expect to see

N \approx \mu\_0 (1 + 1/s\_0) 

events in total, and on the other hand

N = y\_1 + y\_2/s\_0,

and we get rule of thumb estimator

\tilde{\mu} = \frac{y\_1 + y\_2/s\_0}{1 + 1/s\_0},

which coincides with Scaled Poisson estimator.

### Numerical check

Let’s introduce two performance metrics under repeated toy experiments:

\text{bias} = \text{Mean}(\hat{\mu}) - \mu\_0

\text{overdispersion} = \text{RMS}(\hat{\mu}) \left/ \sqrt{\frac{\mu\_0 s\_0}{1 + s\_0}} \right.

the latter motivated by the fact that Scaled Poisson estimator should show the least variance.

I’ve written a script to compare distributions of \hat{\mu} given by `TH1::Fit` with `WL` option, and given by the three choices of the objective function.  
True values are \mu\_0 = 100, s\_0 = 1/100 and 10000 toys are generated.  
[fit\_WL.cxx](https://root-forum.cern.ch/uploads/short-url/6ondAAeqzRsJc2vGrY31KKXmyAv.cxx) (9.8 KB)

### Results

 ![fit_WL](https://root-forum.cern.ch/uploads/default/original/3X/9/7/97be92d39f36cebae4a5427efbb68040f0a221bf.png)

### Discussion

It can be clearly seen that ROOT performs similarly to objective function

> [@Byungchul\_Yu](#):
>
> s\_i \, \Delta\ell\_i^{\mathrm{SPD}} = \Delta\ell\_i^{\mathrm{Poisson}}

or option 2, k\_i = 1, despite the fact that as I see from the source code that ROOT’s objective function to minimize is

s\_i^2 \, \Delta\ell\_i^{\mathrm{SPD}} = s\_i \Delta\ell\_i^{\mathrm{Poisson}}

which is very confusing for me. It is likely that I interpreted the source code incorrectly.

Nevertheless, it is also clear that option 3, k\_i = 1/s\_i objective function

\Delta\ell\_i^{\mathrm{SPD}} = \frac{1}{s\_i} \Delta\ell\_i^{\mathrm{Poisson}}

outperforms ROOT `TH1::Fit` with `WL` option in this specific setting.  
This can be explained by the fact that s\_0 \ll 1, and neglecting this factor exaggerates variance of the ROOT estimator.

Despite the fact that scale factor affects likelihood term for the second bin by two orders of magnitude, variance of the estimator is degraded only approximately by factor of 5, which is fully explained by overdispersion formula:

\sqrt{\frac{1 + s\_0}{4} \times \frac{1 + s\_0}{s\_0}} = \frac{1 + s\_0}{2\sqrt{s\_0}} = 5.05

For s\_0 = 1/T and large T, overdispersion degrades asymptotically quadratically, \propto \sqrt{T}

The effect of non-constant, random event weights on estimator performance is unknown at this point, but it is intuitively appealing that variance in weights inside bin would introduce additional overdispersion.  
In practice I’d expect that effective statistics is large, meaning that s\_0 \lesssim 1, and overdispersion does not degrade significantly.

For non-linear models I claim that mis-specification of weights for likelihood terms might emphasize wrong local minima or assign more weight to a steeper gradient descent direction, introducing bias and amplifying variance of resulting estimator.  
The latter can be corrected by sandwich covariance estimator though.

### Conclusion

The numerical check on this toy problem converged to @Byungchul_Yu suspicion that ROOT minimizes Poisson deviance.  
In the simple setting with two bins and constant event weights there exists an estimator which minimizes Scaled Poisson deviance and outperforms ROOT’s `TH1::Fit` with `WL` option.

Dear @Byungchul_Yu , please check if the results of the scripts are similar for you.

I would like also to humbly invite other experts, @jonas and @StephanH to the discussion.

---

<div class="post-metadata">

**Author:** ![Ako\_b](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Post date:** [September 15, 2026, 6:55pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/12 "2026-09-15T18:55:37Z")

</div>

Hello again, @Byungchul_Yu !

I apologize for not actually directly addressing your last question:

> [@Byungchul\_Yu](#):
>
> - If the scaled-Poisson deviance is sufficient by itself, then no additional prefactor of s\_i 𝑠𝑖 should be multiplied in front of it. Is there a ROOT version in which the `WL` method is implemented in this way, with the scaled-Poisson deviance used directly, and with the parameter uncertainties/covariance also calculated consistently?

Firstly, it appears that starting from the version [v5.30](https://github.com/root-project/root/commit/1c6a2a0c16c9609e9f2095ea7e440c6f9b3672ea) when `WL` feature was first introduced, the formula for the Scaled Poisson Deviance was incorrect, and ROOT’s objective function always have been

\Delta l^\text{ROOT} = s\_i \times \Delta l^\text{Poisson} = s\_i \times \left( -y\_i \log\frac{\mu\_i}{y\_i} + \mu\_i - y\_i \right)

where \mu\_i is model prediction for bin content, y\_i = \sum w is bin content and s\_i = \sum w^2/ \sum w is scale factor.

Secondly, I’ve tested `EvaluatePoissonLogL` function (which is back-end behind `WL` option) in debugger and discovered that actual ROOT’s minimization strategy is to perform _unweighted_ fit first with objective function

\Delta l^\text{Poisson} = \left( -y\_i \log\frac{\mu\_i}{y\_i} + \mu\_i - y\_i \right)

and then invoke \Delta l^\text{ROOT} variant to calculate corrected covariance matrix.  
But since the \Delta l^\text{ROOT} not divides by s\_i but multiplies by s\_i in the first place, this correction also yields incorrect error bounds.  
Unfortunately I can’t share gdb scripts to reproduce this behaviour right at the moment.

To summarize, I strongly suspect that current implementation `WL` is not reliable, and there was never a ROOT version with correct implementation in the past.  
I would advise you to implement custom objective function adapted for your use case and statistical model, and you can look at the `struct CustomNLL` and function `CustomFit` in the script attached to the previous message.  
You can also take a look at “User-defined fitting methods” section of [ROOT’s fitting manual](https://root.cern/manual/fitting/)

---

<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:** [September 29, 2026, 6:56pm UTC](https://root-forum.cern.ch/t/question-about-the-scaling-factor-in-root-s-weighted-poisson-log-likelihood-wls-fit/64952/13 "2026-09-29T18:56:04Z")

</div>

Closed on September 29, 2026, 6:56pm UTC

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