Power of chi-square test for goodness-of-fit as function of sample size

I would like to calculate the power of a Chi-Square test for goodness-of-fit as a function of sample size for a specified alpha-value (say 0.01). Specifically, I am referring to power as the probability that the test will correctly reject the null hypothesis. In most places I look, I can find only vague references that this can be done and/or am referred to software. It seems to me that this should not be difficult. The specific question I would like to be able to answer (without using some sort of opaque software) follows:

Given an $\alpha$ value, for what sample size, $n$, can I expect a particular power, $\beta$?

Even better, how might I be able to calculate an ROC?

-

1 Answer

Does R fall into your idea of opaque software? If you are interested in this sort of calculation I would strongly recommend you use a stats package of some sort - and probably R in particular. In R, package pwr provides the function pwr.chisq.test which answers your question for you.

It isn't quite as simple as saying "for each sample size, what is the power of my test?" because as well as sample size, there is the question of the size of the effect in the underlying population you are inferring to. eg if there is a massive effect, then even a very small sample has a high power. As the effect gets smaller, you need a bigger sample size for the same power.

The documentation for pwr.chisq.test refers to Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale,NJ: Lawrence Erlbaum.

Also, a quick google search comes up with this reference (lecture 25), which shows that under the alternative hypothesis the test statistic has (asymptotically) a non-central Chi square distribution and provides a way to estimate the non-centrality parameter for a given alternative hypothesis.

-

Ideally, what I would like is a good reference.  I do not want to use software without a very solid fundamental understanding of what I'm doing. – cyrus1.618 Mar 29 '12 at 16:51
I understand that effect size plays into it as well.  My issue is that I can't find a satisfactory explanation for this calculation that does not at some point simply fall back and refer to software.  It seems to me that this is something that should not be too difficult.  I suppose this begs a further question: why is it so difficult to find a good explanation?  Is it because it is considered too elementary?  Thanks! – cyrus1.618 Mar 29 '12 at 16:54
ok, I've added some references – Peter Ellis Mar 29 '12 at 18:41
Thanks for the references.  The url reference is tangentially related (my distributions are not multinomial) - but it does illustrate an approach.  Upon first glance in Cohen - it appears as if as soon as the text gets to power analysis of the chi-square test, it immediately jumps to tables without explanation of the derivation of the tables.  I'll have to give a more thorough read through.  Thanks for the references! – cyrus1.618 Mar 29 '12 at 23:52
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 3, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9450452923774719, "perplexity_flag": "head"}