# How to choose correct distribution in R

I want to plot a probability distribution. I know the mean and think that a normal distribution would be a poor description of my beliefs. I either assume that the values smaller (or larger) than my mean are more likely to occur than the ones larger (or smaller). I don't know anything else, except, that the values are somehow in the vicinity of my mean...

For example, my mean is 0.151 and I believe that larger values are more likely to occur than smaller ones. What distribution should I choose and how can I implement this in R?

EDIT

The mean represents a share and therefore is limited to [0,1]. The change I want to predict will be relatively small and start from the mean, resulting to be larger than the mean (or smaller).

It might help to specify, what I don't want:

• A uniform distribution would give specified values the same probability. For example, if I believe values between 0.1 and 0.2 are likely, each value is more or less equal to "happen".
• With a normal distribution the values smaller and larger than my mean would be equal likely with some sd.

EDIT 2

The undertaking: To predict, for example, the share of a given party in election 2, I start with the mean in election 1 (0.151). Additionally, I assume that the values in election 2 are more likely to be larger than 0.151, but of course, I can't be sure.

• There's not enough information to begin to recommend one, outside the fact that you're describing something asymmetric. That's really not much of a basis to suggest something. – Glen_b Nov 11 '15 at 11:01
• That is exactly my problem... Ideally I could just specify the mean and tell some function that it should be left or right skewed. – Thomas Nov 11 '15 at 11:09
• What do you expect this function to do with the information that it's skewed? It's not enough information - there's an infinity of right and left skew distributions. – Glen_b Nov 11 '15 at 11:30
• Thanks for the additional information. I am not sure how you can have a mean of 15.1 if the mean is in [0,1]. What's the possible range of values taken by the data? It's not at all clear to me what you mean by "the change I want to predict will be relatively small and start from the mean, resulting to be lbe larger than the mean (or smaller)." – Glen_b Nov 11 '15 at 11:48
• @Glen_b sorry for the artefact, it is 0.151, of course. – Thomas Nov 11 '15 at 11:59

The possibility of values being exactly 0 and 1 would seem to rule out the just using the beta for all cases (otherwise I'd have suggested it earlier).

One possibility is to use a zero-one inflated beta - which can also be seen as a mixture of a beta and a Bernoulli - a distribution of the mixed type.

Conceived either way it will have four parameters; as a 0-1 inflated beta you'd have the probability at 0, the probability at 1 and the parameters of the beta that describes the remainder.

There's an infinity of other possibilities for skewed distributions in (0,1) of course, which could then be 0-1 inflated, but your specifications are vague and you'd probably want a distribution for which some software is available (see packages like GAMLSS and zoib in R for example, which will fit regressions where the response is of this type).

This gallery of distributions may be helpful.

Most common distributions are implemented in R, and you can use ?? to search, e.g., ??Cauchy. If you are looking for the implementation of a very uncommon distribution in R and don't find it, you can search or ask at SO in the R tag.

Given the information that you have provided I suggest that you try the Beta-distribution. It has support in the interval [0,1] and is probably a good starting point. It is often used to model values that correspond to probabilities.

You should be able to fit the parameters of the distribution with this code:

library(MASS)
fitdistr(x,"beta",list(shape1=1,shape2=1))


Where x is the vector of your data.

Here I have randomly generated some data, fitted the distribution, plotted the data and the fitted model. I urge you to try this out, also it would be nice if you could contain an image similar to the one I post here! That could guide us in the right direction.

library(MASS)
x <- rbeta(10000,4,2)
hist(x,breaks=50, freq=FALSE)

# Estimate the parameters
vals <- fitdistr(x,"beta",list(shape1=1,shape2=1))

# Plot the sampled data
hist(x,breaks=50, freq=FALSE)
# Generate the values to plot the curve
xx <- seq(0,1,len=100)
y <- dbeta(xx,vals$estimate[1],vals$estimate[2])
lines(xx,y,col='red',lwd=2)


Try to reproduce this plot with your data:

• If I could specify, where the most dense region is (in your example about 0.78), from the mean, that would be perfect. – Thomas Nov 11 '15 at 12:40
• @Thomas you do not need to specify it, just make R "figure it out" Otherwise the mean is calculated as $\frac{\alpha}{\alpha+\beta}$, so in this case it would be $\frac{4}{4+2}=\frac{2}{3}$. $\alpha$ and $\beta$ are the shape parameters. The mode (i.e. the peak around 0.78) is calculated with $\frac{\alpha-1}{\alpha+\beta-2}$, in this case $\frac{3}{4}=0.75$. – Gumeo Nov 11 '15 at 12:46
• Note that this information is all in the wikipedia link in the top of my answer. – Gumeo Nov 11 '15 at 12:48