# Fitting an arbitrary distribution to a given mean/mode/median

Given some combination of mean/mode/median, how would I go about generating a distribution that can fit an arbitrary combination?

For cases where mean = mode = median, I would just use a normal distribution. How could I generate a distribution with, say, mean=3.0, mode=4.0, and median=5.0?

I've searched around and couldn't find an answer for this, which suggests maybe it's a silly question. Apologies if that's the case

Edit: I'm looking to create a visualization that plots a distribution that reacts as you change the mean/mode/median with sliders. Partially for teaching purposes and partially as a programming exercise, I just want to make something I can show students to demonstrate why it's important to have those numbers.

Are there distributions with parameters that are easy to set up some optimization algorithm for, to hit a target mean/median/mode?

• Your question is not silly, but it's not specific enough, because there are just too many answers and too many ways to answer it. You need to narrow (considerably) the range of possible solutions. This is one purpose of using various families of distributions, of which there are many. But it would be rare indeed to have information only about the mean, median, and mode, so could you explain the context in which this question arises? That might give us clues to the nature of a good answer.
– whuber
Jan 24 at 19:06
• I'm looking to create a visualization that plots a distribution that reacts as you change the mean/mode/median with sliders. Partially for teaching purposes and partially as a programming exercise, I just want to make something I can show students to demonstrate why it's important to have those numbers. Are there distributions with parameters that are easy to set up some optimization algorithm for, to hit a target mean/median/mode? Jan 25 at 20:22
• There are plenty, of many different shapes. You will find satisfactory flexibility among the Pearson distribution family, for instance. You can also fix the median and change the mean by arbitrarily large amounts by mixing one outlier on one side and an "inlier" on the other side. The mode is problematic because any continuous distribution can be given any number of modes at arbitrary locations without changing its salient properties. See my second diagram at stats.stackexchange.com/a/86503/919 for an illustrated example.
– whuber
Jan 25 at 20:53

For roughly normal distributions, the median is roughly the weighted average of the mean, the mean and the mode. So a roughly normal distribution with mean of $$3$$ and mode of $$4$$ would have median of roughly $$10/3$$, nowhere near $$5$$.