3

I figure, if I measure something in meters, and then take a chi-square from it to test a hypothesis, the value I get will be in meters too. But that doesn't make sense: by simply switching to kilometers, I'd get a 1000 times smaller value.

Or is it only supposed to be used with dimensionless quantities to begin with? For example, if I am using poll data (yes, Presidential) to test a hypothesis, should I use percentages as inputs or actual numbers of people that voted?

It seems that the latter would make more sense (if a poll includes two people, and both vote one way, it's 100%, but doesn't mean very much), but brings the question of units into the picture (if I count people in thousands, rather than in persons, I'd get a very different result).

Dima
  • 131
  • 1
    Great question! I expect it would get more responses on stats.stackexchange.com than here. – Vincent Oct 12 '16 at 11:13
  • In the chi-squared test for two by two tables the test statistic is a sum of terms of the form (observed - expected)^2/expected and hence has unit humans^2/humans = humans. – Vincent Oct 12 '16 at 12:19
  • Ehm, my last comment was in response to another comment by Oscar something, but it has since been deleted. – Vincent Oct 12 '16 at 12:20

1 Answers1

1

You mention at least two fundamentally different uses of the chi-squared distribution.

Confidence interval of normal variance. Let $X_1, \dots, X_{10}$ be a sample of size $n = 10$ from $Norm(\mu = 100, and \sigma = 20).$ Suppose $\mu$ and $\sigma$ are unknown to us. Then a 95% confidence interval (CI) for $\sigma^2$ is based on the fact that $Q = (n-1)S^2/\sigma^2 \sim Chisq(df = 9),$ were $S^2$ is the sample variance. In particular, we use $q_L$ and $q_U$ such that $P(q_L < Q < q_U) = .95.$ A probability-symetric CI would use quantiles .025 and .975 of $Chisq(9)$ for the $q$'s: $q_L = 2.70$ and $q_U = 19.02.$

Then a 95% CI for $\sigma^2$ is $(9S^2/q_U, 9S^2/q_L).$ In particular, for the data generated below, where $S = 20.023,$ a 95% CI for $\sigma^2$ is $(189.7, 1336.2)$. Upon taking square roots, a 95% CI for $\sigma$ is $(13.8, 36.6).$

 x = rnorm(10, 100, 20); s = sd(x); s  # simulated dataset and its SD
 ## 20.02325
 q = qchisq(c(.975,.025), 9); q        # quantiles for CI
 ## 19.022768  2.700389
 ci = 9*s^2/q; ci                      # 95% CI for pop var
 ##  189.6871 1336.2423
 sqrt(ci)                              # 95% CI for pop SD
 ## 13.77270 36.55465

Now for the units: Both $\sigma$ and $S$ have the units of the data (perhaps meters); both $\sigma^2$ and $S^2$ have squared units ($m^2$), the quantiles $q_L$ and $q_U$ have no units; the CI for $\sigma^2$ has squared units, and the CI for $\sigma$ has the same units as the data. If you convert to feet instead of meters, of course $S$ and the CI for $\sigma$ will change accordingly. But the relevant chi-squared distribution and its quantiles will not change.

Goodness-of-fit tests. Suppose I roll a die $n = 60$ times in an attempt to see whether it is fair. I observe counts $X = (10, 14, 11, 12, 3)$ for die faces 1 through 6, respectively. Of course, for a fair die the expected counts are $E = 10$ for each face. A chi-squared goodness-of-fit (GOF) test has test statistic $Q = \sum_{i=1}^6 (X_i - E)^2/E = 7.0.$ Because expected counts exceed 5, it is safe to assume that $Q \stackrel{aprx}{\sim} Chisq(df=5).$ If $Q$ exceeds the 95th quantile $q = 16.92$ of $Chisq(5)$, we would judge the die to be unfair, but $Q = 7.0$ does not provide evidence of unfairness.

Now if I were to roll the die $n=600$ times and observe counts $X = (100, 140, 110, 120, 30)$ with expected counts $E = 100,$ then $Q = 70,$ and I would conclude the die to be unfair. Notice that the degrees of freedom parameter is still 5, because there are still 6 faces (categories).

The sample size $n$ is not directly reflected in the chi-squared distribution used for the test. However, in a real experiment, the value of $Q$ may be influenced by $n$. My "counts" $X$ for the 600-roll "experiment" are fake. I merely multiplied the truthful counts for the 60-roll experiment by 10. But that produces totally unrealistic counts for a 600-roll experiment. (By analogy, we are not surprised to get 6 heads in 10 tosses of a fair coin, but we would be astonished to get 600 heads in 1000 tosses.)

One must never judge goodness of fit just by looking at a bar chart of various categories, because bar charts do not give visual information on how much data there is. Bar charts for my real 60-roll experiment and my fake 600-roll experiment would look the same.

BruceET
  • 51,500