I've got a table with 59 different values for my response variable, with different amounts of number of observations for each one of them (from 1 to 5e5, so that I observed the least frequent value once, and over 5e5 times the most frequent). This follows a normal/Gauss distribution for which I've already calculated mean, median, mode, variance and standard deviation. I've got around 5.8 million observations on this dataset.

The mean is 64.833 while the mode and median are both 65, but I found out that 44% of the observations are higher than 65 and 48% of them are lower (8% of the observations have the value of 65). My standard deviation (for a mean of 64.833) is 5.305.

Getting to the point, I want to know how significant is this difference (those 4%), considering my standard deviation. How can I calculate that? If it's significant at say, 5 or 10% and, if not, the lowest p-value at which that would actually be significant?

I'm currently thinking on using a Hypthotesis with 64.833 as my sample mean (x) against 65 as the population mean (u), as

H0: x=u H1: x!=u


My problem here is what I should use as 's' (standard deviation with 65 or 64.833 as mean?) and what I should be using as 'n' (the 5.8 million observations in the whole dataset?).

Would that work, calculating z with those values? X as 64.833, u as 65, s as 5,305 (my standard deviation with 64.833 as mean) and n as 5.8 million (my sample size that lead me to 64.833 as mean)?

Using that, I got z=-75.505, which got me a p-value of 0.00001... but I don't know if that should be it. It seems that due to the high n, pretty much anything would be significant, so I'm not sure if I should be using 5.8 million as my n or not...

  • $\begingroup$ Your description "59 different values for my response variable" sounds like you have a discrete distribution, which would preclude it from being normal. Can you explain more about your data? $\endgroup$ – Glen_b Sep 15 '16 at 6:01

The mean is 64.833 while the mode and median are both 65, but I found out that 44% of the observations are higher than 65

You shouldn't use a sample quantity (such as the median) as your hypothesized value because you're ignoring the variability in that sample quantity (and indeed, the dependence between it and the estimate of the mean).

However, it is possible to set up a hypothesis test of whether the mean and median are "too far apart" to be consistent with being drawn from a normal distribution.

For example, $(\bar{x},\tilde{x})$ are asymptotically bivariate normal (under mild conditions) and so with a consistent estimate of scale we can construct an asymptotic Z-test (though in the absence of some small sample adjustment to the variance of the difference, the asymptotics aren't so great until the sample size is a fair bit larger than 100):

Specifically, for iid samples drawn from a normal population $$Z\approx 1.324\frac{\bar{x}-\tilde{x}}{s/\sqrt{n}}$$ is asymptotically standard normal. Note that despite its superficial similarity to a $t$-type statistic, in small samples it's lighter tailed than normal (see Q-Q plots). [This statistic can be inferred from the information in Ferguson[1], though the relevant result there dates back to Laplace.]

With a suitable small-sample adjustment to the constant, this would be reasonable at more moderate sample sizes (though the non-normality of the statistic eventually becomes more of an issue as you creep down).

Another option would be to use simulation at whatever sample size you have - then the distribution doesn't matter.

However, from your description (where is sounds like you have binned data), neither option would be directly suitable.

[1] Thomas S. Ferguson (1999)
Asymptotic Joint Distribution of Sample Mean and a Sample Quantile

| cite | improve this answer | |

Significance is dichotomous, not scalar. Furthermore, testing the hypothesis that the median is 65 (which seems to be what you're asking for) would in this case clearly constitute hypothesizing after the results are known, which is of very dubious value.

A better way to make an inference about the population median would be to compute a confidence interval for it.

| cite | improve this answer | |
  • $\begingroup$ I was actually trying to compare the means, not medians, trying to see if there was significance comparing a mean of 65 to my actual mean of 64.833... my hypothesis here is actually that "The probability of a random unit having the response variable higher than 65 is equal to the probability of it having a response variable lower than 65", so I guess I should compare means (if the probability is the same, so the mean should stand at 65) $\endgroup$ – Tanoh Sep 14 '16 at 6:19
  • $\begingroup$ @Tonah No, the mean does not have that property. You're thinking of the median. For example, the mean of the standard lognormal distribution is about 1.63, but 69%, not 50%, of values are below 1.63. $\endgroup$ – Kodiologist Sep 14 '16 at 14:27

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.