Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

How can I describe the shape of the following distribution, which has two peaks? What are the important things in describing the distribution shape?

It is the output of the following R code: plot(density(Boston$tax)) enter image description here

(The data set is in the MASS package)

I would like to know what rug (these red points) are showing in the previous PDF? enter image description here

I created it by the following code on Boston data from MASS package:

plot(density(Boston$tax))
    rug(Boston$tax, col=2, lwd=3.5)
share|improve this question
    
Are you familiar with finite mixture models? –  Dimitriy V. Masterov Feb 12 at 3:09
    
No! Not unfortunately ! –  Mona Jalal Feb 12 at 3:10
    
Then this post may prove helpful. It doesn't use R and a mixture of Poisson distribution, but these can be changed. If you post/describe your data, you may get better suggestions. –  Dimitriy V. Masterov Feb 12 at 3:16
    
Which package is the data set "Boston" in, if any? –  Glen_b Feb 12 at 3:29
2  
@Glen_b It's the MASS package, so tax if the "full-value property-tax rate per $10,000" –  Dimitriy V. Masterov Feb 12 at 3:46

1 Answer 1

up vote 6 down vote accepted

To describe such a two-peak shape to another person, you'd call it 'bimodal' (which just means 'two modes' - generally taken to be two local modes, even though only one of them might be 'the mode' of the distribution).

You could then seek to describe the locations and spreads and relative proportions or heights of the peaks (this might be done visually, or more formally, for example with Gaussian mixture model).

e.g. as a first, simple description, I might say "the distribution appears to be bimodal with the main peak at around 290 and a lower peak around 670"

- and then if necessary give additional detail on the relative heights at or widths-of/ areas-under the curve around the peaks, if any of those details matter to your audience (e.g. something along the lines of "the spread of the peak around the main mode is wider than that around the smaller mode").

If we're thinking in terms of something close to a Gaussian mixture model, there's a slight suggestion of a third "bump" coming in near 420, but its close enough to the bigger mode that it doesn't make a separate peak.


Those red marks you got using rug are the actual data values; for each observation, one red mark is placed in the margin (akin to the marks you see with stripchart(Boston$tax,pch="|")). You'd normally mark them with thin lines rather than wide lines as you have there. Because the values are placed at the edge of a plot, the marks look a little like the fringe tassels on the edges of a rug. That has nothing to do with the kernel density estimate itself (other than showing the data from which the KDE was computed), it's just adding a different kind of information to the plot; you could use rug to add information to various other displays of the data. A rug-plot is just a marginal (to some main plot) one-dimensional plot of the data values.

A rug plot is not as informative when the data has a lot of repeated values (as the tax variable does - for example, there are 132 values at 666 which are all drawn one on top of the other); you can normally improve that with a little bit of 'jitter', but there are so many repeated values that even rug(jitter(x,amount=20)) doesn't distinguish the values. For that situation might be better to use transparency and a smaller amount of jitter, or some other indication, such as a dot plot:

plot(density(Boston$tax),col=3)  #$
stripchart(Boston$tax,add=TRUE,pch=16,cex=.03,at=-0.00013,method="stack",col=8)

enter image description here

share|improve this answer
    
Can you please take a look at the updated diagram and tell me what does it mean to have a rugged PDF? –  Mona Jalal Feb 12 at 4:11
1  
I've written a short description of what those values are. –  Glen_b Feb 12 at 4:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.