I have a population with age range 0-6 years old. A survey asked various "Choose all that apply" questions and I'd like to compare the age densities for each subset (Did choose option X, Did Not choose option X), to look for age ranges where significant differences appear to have occurred.

The reported ages are actually discrete, since people round to the nearest month below about two-years-old and to the nearest half year after that. (I'm using R's density to come up with the monthly density from 0-6, to try to smooth through the many zeros that would occur for months at higher ages.) The overall age density is:

enter image description here

My first attempt was to take the ages from each partition (Checked, Not-checked), calculate a density, and do a Chi-squared (or K-L divergence or Hellinger distance) test between the two subset densities to determine statistical significance. If the differences between the two densities seem statistically and (non-subject-matter-expert) actually significant, I plotted the two densities on a single graph. For example:

enter image description here

But then I thought that there is an overall age density for the total population and perhaps I should "normalize" the two subset densities by dividing each by the overall density. Or maybe I should subtract the overall density from each. Those would show more of a "deviation from the whole" kind of graph. (In the example, the TRUE's much more closely reflect the overall population since they make up the vast majority: 314 out of 350.)

Do any of these three ideas (raw, divide by overall density, subtract overall density) make any (statistical) sense?


Dividing by the density or subtracting it may turn out impractical, because it depends how you estimate it. By default R uses a smoothing window that often looks nice but which is by no means the only one that makes sense.

Actually this is why I would take the raw data and perform a Wilcoxon test to identify shifts in the distribution. You could also do a KS test if you are interested in change of spread or other features.

  • $\begingroup$ Does the Wilcoxon test better handle the zeroes that will occur in the higher ages, or do you recommend it over, say, a Chi-squared test, for other reasons? $\endgroup$ – Wayne Jun 4 '12 at 14:24
  • $\begingroup$ The 0's are not an issue in the Wilcoxon test because you just compare (list of ages of group A) vs (list of ages of group B) even if they have different number of observations. In the $\chi^2$ you probably have to pool some classes with low expected counts, which is another inconvenience. Actually, the only reason why I would recommend Wilcoxon is convenience. You can take your data and test it, no pooling, no normalization etc. This also makes it more reproducible by others. $\endgroup$ – gui11aume Jun 4 '12 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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