Hello experts, I’m fitting a weighted MC dataset with non-integer values using the chi2FitTo() method and a minimization algorithm to optimize chi2/ndof . In my case, Fval is equivalent to chi2/ndof.
Since I’m working with weighted data, I’m using SumW2 to correctly compute the uncertainty (sigma) for chi2. Unlike standard bins where sigma= root square of y data, in this case, sigma is computed as the sum of the square root of weights in each bin: I obtain correct results using:
However, this does not work when using: frame.chiSquare(npar)
Does frame.chiSquare(npar) handle weighted data differently? Any suggestions on how to correctly use it in this case?
Could you please add more context to your code snippet by explaining 1. if frame.chiSquare(npar) raises an error (and which one if so) and 2. how did you define the frame object?
Hi @mdessole, frame.chiSquare did not raise an error, but it gave me an unexpectedly high value of chi²/ndof. I suspect that it does not compute the uncertainty as sqrt(sum of squares of weights), which may explain the odd result. About the frame object aims to creat a rooplot object, where i can plot my data as well as my model.