# Value for which the PDF(value) is maximal in a distribution with skew?

I am working on a project where I need to chart statistical data and related, skewed distributions a la http://en.wikipedia.org/wiki/Skew_normal_distribution.

Unlike with normal distributions, in these charts, when there is skew, neither the mean nor the median appear to be at the maximal point of the probability distribution curve drawn along the graph's domain, which is fine, but does this point have a name? And more importantly, is there a more direct way to discover the value along the domain of values such that the PDF(value) has the maximal value?

I can currently find this point with a binary search hill-climbing algorithim, but, this seems a rather round-about way to go about it.

While this point may or may not have any intrinsic value in statistics, from the standpoint of scaling the resulting graphs, I'd like to calculate the highest point of the distribution.

I am not a statistician, so it could very well be that the answer is on the very Wikipedia page I posted above, but I am not familiar with the parlance of this level of Statistics.

Summary

The consensus is that there is no closed form of computing the mode from an arbitrary Skew Normal Distribution, so, a Hill Climbing algorithm is probably a sensible approach. A good starting point for the algorithm, seems to be the distribution's median, which does have a closed form, and except in cases of extreme skew, is fairly close to the mode. At extreme skews, the location is probably the best starting point. I have created a nifty animation in R to visualise this:

PS: R is fun! =)

• The maximum of the pdf is known as the "mode". Estimating it from data can be tricky, though. – Hong Ooi Sep 2 '14 at 15:47
• Sure--that's a routine procedure to maximize the PDF given its functional form, as taught in Calculus. What @Hong Ooi is alluding to, though, is that since your question mentions data, then those parameters apparently were estimated from the data and therefore are uncertain. The questions of statistical interest become (1) how does that uncertainty translate into uncertainty about the location of the mode and (2) why are you estimating a mode in the first place? The latter is important because it determines how the parameters should be estimated, which in turn influences the answer to (1). – whuber Sep 2 '14 at 16:08
• If you're only using this to scale the image, just compute the function value along the pixels that you're going to plot and find the max of that array. – Dougal Sep 2 '14 at 19:23
• Thank you for the explanations. I changed the tags to reflect your objectives and to help suggest how this question might be on topic at this site. Although finding the mode in general is really a pure math topic, in this setting there are practical complications arising from PDFs that become infinite and from discrete distributions, as well as a dichotomy between parametric families whose modes have simple analytical expressions and families where they do not. It therefore seems like it might be helpful to construe the question as focusing on visualizing the PDF. – whuber Sep 2 '14 at 22:25
• There is no general answer because PDFs can take on a vast number of functional forms and can often be reparameterized in several ways. Therefore, the only possible answers can be either numerical optimization or analytical optimization, i.e. knowing the functional form of the first and derivatives, setting the first derivative equal to zero, etc. The latter option requires that you either know the functional form or compute the analytical derivative, check for concavity, and solve for $arg max$ on the fly. – shadowtalker Sep 3 '14 at 0:38

In the skew normal distribution, the mode (which is not available in closed form) is not too far from the location, then you can produce a sort of automatic R code to find the mode using the R library sn as follows:

library(sn)

mode<-function(mu,sigma,lambda){
temp <- function(x) -dsn(x,mu,sigma,lambda,log=T)
return(optimize(temp,c(mu-2*sigma,mu+2*sigma))\$minimum)
}

mode(10,1,1)


There is another type of asymmetric distributions called "two-piece" distributions for which identifying the mode is straightforward:

http://arxiv.org/abs/1405.4995

http://en.wikipedia.org/wiki/Split_normal_distribution

• Thank you for your submission @BlasterMaster. Unfortunately, I need to implement this in client-side Javascript, so, using R isn't going to cut it for me =). I did try out R though, neat! I find that the location isn't often so close to the mode, but that the median is fairly close, except when the skew is fairly extreme, then the location is indeed pretty close. I use the median as the start of my hill-climbing algorithm, which, even without optimizing, finds the mode in 17-25 iterations, which is fast enough for my needs. – mkoistinen Sep 4 '14 at 20:58