# Testing for significant differences in skewness

How do you test for significant differences in skewness across two distributions of citation data, using R? I'm trying to compare the two power-law distributed histograms below (I'm just using histograms to visualize it, the data is not actually reduced to histograms). The sample sizes are 121 and 85 respectively. The skewness is very different (roughly 3 and 6 respectively), but how do I test if this difference is significant?

• What are you assuming? Under parametric or nonparametric assumptions? (and if parametric assumptions, which ones?) What about independence? Large samples/small samples? (Also, can you say anything about the circumstances in which you need to test for skewness? -- it's a very rare thing to need and understand what you're doing it for may lead to better advice) – Glen_b Nov 18 '15 at 22:35
• @Glen_b: I'm assuming power-law distributions and sample sizes around a 100. I'm actually encountering this problem fairly often, since social data rarely is normally distributed, and therefore I need alternatives to mean comparisons. – histelheim Nov 18 '15 at 22:44
• Just in case it's not obvious, you don't do it by reducing to histograms first. In fact, histograms are almost the worst kind of frequency distribution plot for your purposes. (Box plots are probably worse.) You want any kind of plot on which you can see fine structure as well as distribution level, spread and shape and on which power laws define if not a straight line, then a defined curve. – Nick Cox Nov 18 '15 at 23:27
• I've just been trying to decipher your variable name.... is your variable a count?? – Glen_b Nov 19 '15 at 0:02
• Then don't visualize it with histograms! I've added some comments to my post. I'll have to try to address the issue of zeta/Zipf later. – Glen_b Nov 19 '15 at 3:50

Presumably your variable is continuous (otherwise a histogram like that would be a really bad choice of display), so I assume by "power-law" distribution you intend the Pareto, $f_X(x;\alpha,c) = \frac{\alpha}{c}\left(\frac{x}{c}\right)^{-\alpha-1}\cdot\mathbb{I}_{x>c}$, and by the look of it, with a common value for $c$ for your two populations (not that it matters all that much for this, but it's simpler in that case).

Since the skewness of the Pareto is purely determined by the index, $\alpha$, if they share the same $\alpha$, they share the same skewness. Consequently a test for equality of $\alpha$ is a test for equality of skewness.

If the lower bound, $c$ is known (for an unshifted Pareto it would have to be $>0$), then $\log(x/c)$ is exponential and you're dealing with comparing scale parameters of exponentials, which could be done in a couple of ways, (for example, you can derive an F-test for equality of exponential parameters) but I'd probably just do it via a GLM unless the sample sizes were fairly small.

If $c$ is unknown it's a little bit more involved, and if $c$ is not the same for both, there's a little more to it again, but both cases would be doable.

If you only expect it to be a power-law above some threshold, then there's some more discussion required.

If your variable is a count (a possibility you gave no indication of, but it now occurs to me that you might have that case) you're dealing with a different situation again, and presumably want a zeta distribution or Zipf's law.

Edit: It now appears you do have a count. This is critical information and should have been made clear to start with. Your histogram is both not very informative and actively misleading, so it helped lead me astray. I'll come back and edit some more, but for now, some advice (besides "explicitly mention when your data are counts"):

or even

I made that second plot using something like
plot(table(factor(x,levels=(min(x):max(x)))),ylab="Frequency") and the third one using a similar command followed by points (on the same argument) with type="p" and pch=16.