When was the last time you needed an asymmetric (skewed) probability density function (pdf) with infinite support? Traditional skewed distributions like the gamma family suffer from a semi-infinite support, that is, . The support, if you are out of the loop, is the set of values in the domain of such that . Why is this inconvenient? well, I will give more details about the specific application later, meanwhile, let’s say that the fact that its derivative is discontinuous at is problematic; even more, I need my function to be at least in , that is, to have at least continuous derivatives!.

This post constitutes a somewhat dirty solution being as unwilling as I am to review any literature in depth (I might be inventing the wheel again, some wheel, but who cares; this is a blog!). Here we go.

Firstly, it is important that for all . I also need that . One function that satisfies this, at least for is the so-called -function (this name for this particular function seems to be exclusively used in neuroscience). It has the form:

,

defined only for . is actually the ratio of the rise/decay rates of the curve; you can think about that as some sort of spread of the distribution. The graph of the -function looks something like this:

From now on, the domain of the pdf will be time (but !). In order to get the other half of the domain filled, I will *glue* a second -function but supported in . With the appropriate glue, the resulting function should be supported in the whole real line. How does this “appropriate” “glue” looks like? Well, let’s start by imposing some conditions. Let our two -functions be: and (notice the inverted the time for the second one). The conditions are then:

- There should be some such that
- In order for the connection to be “smooth”, , where . That is, the derivatives should be the same at that point so that one function follows smoothly after the other.
- Looking at the domains of and , considering that should be always within the domain of both functions, I should have
- Ideally, also the higher order derivatives for at most , but I won’t worry about that for the time being.

Now, I will follow a semi-analytical procedure to find , and , given , , and . Effectively, what I am going to do is to keep still while translating and scaling until it satisfy the conditions above. Instead of trying to bruteforce my way through the problem, let’s see what kind of information can be extracted from the previous conditions.

From the condition 1, ,we have

.

From the condition 2,

.

Combining those two, I conclude that, for the right values of and , the rational function

,

should be zero (i.e. ). I could keep looking through the next derivatives for more equations to get the exact values, but, as lazy as I am, I switch to numerical mode. Using the *fsolve* function of Matlab, let’s solve iteratively the following surrogate function

for each for some M. As it can be seen in the following picture, some times the function will have no roots (above the zero line)

that means that that particular value of is not good and we move on. Note the two asymptotes of at and .

The value of for which a root is found corresponds to a good glue point. We can now go on and compute and combine the and in a final function :

FInally, it remains to be seen if this function has more derivatives (we might want to add more restrictions). Perhaps, we would also want to normalize it such that . Besides, we could try to find the new mean, variance, kurtosis and the like. Those things will have to wait until a future post.

A short word about the application. I wanted a highly smooth synthetic firing rate density for neurons with that prescribed profile (for more information about this particular detail, check the corresponding post… in the future). This profile is not expected to be seen (sought after?) in data (so no data fitting available), it is just a hypothetical profile that was desired to answer some questions that go beyond the current topic.