# Clarifying a user defined function (skewed gaussian)

**URL:** <https://root-forum.cern.ch/t/clarifying-a-user-defined-function-skewed-gaussian/42186>\
**Category:** Newbie\
**Tags:** roofit\
**Created:** [November 9, 2020, 6:18pm UTC](https://root-forum.cern.ch/t/clarifying-a-user-defined-function-skewed-gaussian/42186 "2020-11-09T18:18:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [November 10, 2020, 8:40am UTC](https://root-forum.cern.ch/t/clarifying-a-user-defined-function-skewed-gaussian/42186/3 "2020-11-10T08:40:15Z")

</div>

Hi,

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](https://en.wikipedia.org/wiki/Skew_normal_distribution)

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

```

Lorenzo

---

_[View the full topic](https://root-forum.cern.ch/t/clarifying-a-user-defined-function-skewed-gaussian/42186)._
