Home | News | Documentation | Download

Clarifying a user defined function (skewed gaussian)


I am trying to figure out how to use a skewed gaussian to fit my data. In the process of searching for how to implement this in root, I came across the following resource that seems relevant, but I am unsure about one thing.


My question:
What does (x<[1]) do in the following line?

TF1 *sgf = new TF1("sgf","[0]*exp(-0.5*pow((x-[1])/([2]+(x<[1])*[3]*(x-[1])),2))");

Does anyone have a better recommendation of how to implement a skewed gaussian?

Thank you very much for your help!

Perhaps @moneta can help.

1 Like


I don’t think what provided there is a good implementation. (x<[1]) means that this term is equal to zero when false (x greater than Gaussian mean, parameter [1]) and has value = 1 when is true. Now in that implementation you multiply with a negative term which for some value of x < [1] you will get negative sigma.

For the skewed normal I would use the implementation as suggested in https://en.wikipedia.org/wiki/Skew_normal_distribution

TF1 * f = new TF1("f","2.*gaus(x,[0],[1],[2])*ROOT::Math::normal_cdf([3]*x,1,0)",-3,3);


1 Like

Thank you very much!

Thank you very much for the help!