Combining chi square charecterisitc












3












$begingroup$


I am reading Statistics by David Freedman




Suppose the same die had been used to generate the data in tables 4A and 4C
(p. 531), rolling it first 60 times for table 4A, and then 600 times for table 4C. Can
you pool the results of the two tests? If so, how?




enter image description here



The author then pools the two tests as




Pooled $chi^2$ = 13.2 + 10 = 23.2, d = 5 + 5 = 10, p $approx$1 %.




My question is, why can't we sum the two table to create new frequency table like this(since same dice is used)



enter image description here



and then compute the $chi^2$ statistic with 5 degree of freedom?










share|cite|improve this question











$endgroup$

















    3












    $begingroup$


    I am reading Statistics by David Freedman




    Suppose the same die had been used to generate the data in tables 4A and 4C
    (p. 531), rolling it first 60 times for table 4A, and then 600 times for table 4C. Can
    you pool the results of the two tests? If so, how?




    enter image description here



    The author then pools the two tests as




    Pooled $chi^2$ = 13.2 + 10 = 23.2, d = 5 + 5 = 10, p $approx$1 %.




    My question is, why can't we sum the two table to create new frequency table like this(since same dice is used)



    enter image description here



    and then compute the $chi^2$ statistic with 5 degree of freedom?










    share|cite|improve this question











    $endgroup$















      3












      3








      3





      $begingroup$


      I am reading Statistics by David Freedman




      Suppose the same die had been used to generate the data in tables 4A and 4C
      (p. 531), rolling it first 60 times for table 4A, and then 600 times for table 4C. Can
      you pool the results of the two tests? If so, how?




      enter image description here



      The author then pools the two tests as




      Pooled $chi^2$ = 13.2 + 10 = 23.2, d = 5 + 5 = 10, p $approx$1 %.




      My question is, why can't we sum the two table to create new frequency table like this(since same dice is used)



      enter image description here



      and then compute the $chi^2$ statistic with 5 degree of freedom?










      share|cite|improve this question











      $endgroup$




      I am reading Statistics by David Freedman




      Suppose the same die had been used to generate the data in tables 4A and 4C
      (p. 531), rolling it first 60 times for table 4A, and then 600 times for table 4C. Can
      you pool the results of the two tests? If so, how?




      enter image description here



      The author then pools the two tests as




      Pooled $chi^2$ = 13.2 + 10 = 23.2, d = 5 + 5 = 10, p $approx$1 %.




      My question is, why can't we sum the two table to create new frequency table like this(since same dice is used)



      enter image description here



      and then compute the $chi^2$ statistic with 5 degree of freedom?







      statistics hypothesis-testing chi-squared






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 11 '18 at 4:55







      q126y

















      asked Dec 10 '18 at 9:45









      q126yq126y

      239212




      239212






















          1 Answer
          1






          active

          oldest

          votes


















          2





          +50







          $begingroup$

          Both methods are acceptable. Under the null hypothesis, the frequency table made by pooling the two frequency tables together can be used to compute a $chi^2_{5}$ statistic. And the method that the author suggests is also correct - under the null hypothesis the sum of the $chi^2_5$ statistics will have a $chi^2_{10}$ distribution.



          Your question is an interesting example for comparing the two methods because the methods give quite different results. In Table 4A, it seems like there is significant evidence that $3$ and $4$ are the most likely and and that $1$ is the least likely. However Table 4C suggests a completely different distribution: $5$ is the most likely and $4$ is the least likely. By adding the $chi^2$ statistics together we get a significant result but the large $chi^2$ statistics are suggested by different deviations from the uniform distribution. If we create the pooled frequency table then the distribution is more uniform - the $chi^2_5$ statistic is $7.7$, giving a p-value of $0.17$.



          I've done some simulations of data generated by fair dice rolls: I generate 60 dice rolls in the first data set and 600 in the second. For each generated data sets I then computed the p-value in two ways



          1) pooling the two data sets and then calculating a $chi^2_5$ statistic and p-value, and



          2) calculating a $chi^2$ statistic for both data sets, adding them together, and calculating the p-value using the $chi^2_{10}$ distribution.



          The joint p-values from the two is shown below.
          Pooled p-value vs added p-value
          You can see that it's possible for the added p-value to be very low while the pooled p-value is quite high - one point is an extreme version of the problem that you presented, with two data sets showing very different un-uniform distributions being merged together to form a uniform distribution. Because these deviations from the uniform distributions can cancel each other out, personally I would choose the method that you suggested - pooling the data first and then comparing it to a $chi^2_5$ distribution. Also, the $chi^2$ distribution approximation is more accurate for large data sets (Pearson's $chi^2$ statistic better approximates a true $chi^2$ distribution as the sample size grows).



          Here is the code that I used to generate the plot:



          set.seed(1)
          n1 = 60
          n2 = 600
          N = 10000
          pooledPvals = numeric(N)
          addedPvals = numeric(N)

          for (i in 1:N) {
          r1 = table(sample(6, n1, replace = TRUE))
          r2 = table(sample(6, n2, replace = TRUE))

          pooledPvals[i] = chisq.test(r1 + r2)$p.value
          addedPvals[i] = pchisq(chisq.test(r1)$
          statistic + chisq.test(r2)$statistic,
          df = 10, lower.tail = FALSE)
          }
          plot(addedPvals, pooledPvals,
          xlab = "Method 2 p-value (added)", ylab = "Method 1 p-value (pooled)")





          share|cite|improve this answer











          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3033702%2fcombining-chi-square-charecterisitc%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2





            +50







            $begingroup$

            Both methods are acceptable. Under the null hypothesis, the frequency table made by pooling the two frequency tables together can be used to compute a $chi^2_{5}$ statistic. And the method that the author suggests is also correct - under the null hypothesis the sum of the $chi^2_5$ statistics will have a $chi^2_{10}$ distribution.



            Your question is an interesting example for comparing the two methods because the methods give quite different results. In Table 4A, it seems like there is significant evidence that $3$ and $4$ are the most likely and and that $1$ is the least likely. However Table 4C suggests a completely different distribution: $5$ is the most likely and $4$ is the least likely. By adding the $chi^2$ statistics together we get a significant result but the large $chi^2$ statistics are suggested by different deviations from the uniform distribution. If we create the pooled frequency table then the distribution is more uniform - the $chi^2_5$ statistic is $7.7$, giving a p-value of $0.17$.



            I've done some simulations of data generated by fair dice rolls: I generate 60 dice rolls in the first data set and 600 in the second. For each generated data sets I then computed the p-value in two ways



            1) pooling the two data sets and then calculating a $chi^2_5$ statistic and p-value, and



            2) calculating a $chi^2$ statistic for both data sets, adding them together, and calculating the p-value using the $chi^2_{10}$ distribution.



            The joint p-values from the two is shown below.
            Pooled p-value vs added p-value
            You can see that it's possible for the added p-value to be very low while the pooled p-value is quite high - one point is an extreme version of the problem that you presented, with two data sets showing very different un-uniform distributions being merged together to form a uniform distribution. Because these deviations from the uniform distributions can cancel each other out, personally I would choose the method that you suggested - pooling the data first and then comparing it to a $chi^2_5$ distribution. Also, the $chi^2$ distribution approximation is more accurate for large data sets (Pearson's $chi^2$ statistic better approximates a true $chi^2$ distribution as the sample size grows).



            Here is the code that I used to generate the plot:



            set.seed(1)
            n1 = 60
            n2 = 600
            N = 10000
            pooledPvals = numeric(N)
            addedPvals = numeric(N)

            for (i in 1:N) {
            r1 = table(sample(6, n1, replace = TRUE))
            r2 = table(sample(6, n2, replace = TRUE))

            pooledPvals[i] = chisq.test(r1 + r2)$p.value
            addedPvals[i] = pchisq(chisq.test(r1)$
            statistic + chisq.test(r2)$statistic,
            df = 10, lower.tail = FALSE)
            }
            plot(addedPvals, pooledPvals,
            xlab = "Method 2 p-value (added)", ylab = "Method 1 p-value (pooled)")





            share|cite|improve this answer











            $endgroup$


















              2





              +50







              $begingroup$

              Both methods are acceptable. Under the null hypothesis, the frequency table made by pooling the two frequency tables together can be used to compute a $chi^2_{5}$ statistic. And the method that the author suggests is also correct - under the null hypothesis the sum of the $chi^2_5$ statistics will have a $chi^2_{10}$ distribution.



              Your question is an interesting example for comparing the two methods because the methods give quite different results. In Table 4A, it seems like there is significant evidence that $3$ and $4$ are the most likely and and that $1$ is the least likely. However Table 4C suggests a completely different distribution: $5$ is the most likely and $4$ is the least likely. By adding the $chi^2$ statistics together we get a significant result but the large $chi^2$ statistics are suggested by different deviations from the uniform distribution. If we create the pooled frequency table then the distribution is more uniform - the $chi^2_5$ statistic is $7.7$, giving a p-value of $0.17$.



              I've done some simulations of data generated by fair dice rolls: I generate 60 dice rolls in the first data set and 600 in the second. For each generated data sets I then computed the p-value in two ways



              1) pooling the two data sets and then calculating a $chi^2_5$ statistic and p-value, and



              2) calculating a $chi^2$ statistic for both data sets, adding them together, and calculating the p-value using the $chi^2_{10}$ distribution.



              The joint p-values from the two is shown below.
              Pooled p-value vs added p-value
              You can see that it's possible for the added p-value to be very low while the pooled p-value is quite high - one point is an extreme version of the problem that you presented, with two data sets showing very different un-uniform distributions being merged together to form a uniform distribution. Because these deviations from the uniform distributions can cancel each other out, personally I would choose the method that you suggested - pooling the data first and then comparing it to a $chi^2_5$ distribution. Also, the $chi^2$ distribution approximation is more accurate for large data sets (Pearson's $chi^2$ statistic better approximates a true $chi^2$ distribution as the sample size grows).



              Here is the code that I used to generate the plot:



              set.seed(1)
              n1 = 60
              n2 = 600
              N = 10000
              pooledPvals = numeric(N)
              addedPvals = numeric(N)

              for (i in 1:N) {
              r1 = table(sample(6, n1, replace = TRUE))
              r2 = table(sample(6, n2, replace = TRUE))

              pooledPvals[i] = chisq.test(r1 + r2)$p.value
              addedPvals[i] = pchisq(chisq.test(r1)$
              statistic + chisq.test(r2)$statistic,
              df = 10, lower.tail = FALSE)
              }
              plot(addedPvals, pooledPvals,
              xlab = "Method 2 p-value (added)", ylab = "Method 1 p-value (pooled)")





              share|cite|improve this answer











              $endgroup$
















                2





                +50







                2





                +50



                2




                +50



                $begingroup$

                Both methods are acceptable. Under the null hypothesis, the frequency table made by pooling the two frequency tables together can be used to compute a $chi^2_{5}$ statistic. And the method that the author suggests is also correct - under the null hypothesis the sum of the $chi^2_5$ statistics will have a $chi^2_{10}$ distribution.



                Your question is an interesting example for comparing the two methods because the methods give quite different results. In Table 4A, it seems like there is significant evidence that $3$ and $4$ are the most likely and and that $1$ is the least likely. However Table 4C suggests a completely different distribution: $5$ is the most likely and $4$ is the least likely. By adding the $chi^2$ statistics together we get a significant result but the large $chi^2$ statistics are suggested by different deviations from the uniform distribution. If we create the pooled frequency table then the distribution is more uniform - the $chi^2_5$ statistic is $7.7$, giving a p-value of $0.17$.



                I've done some simulations of data generated by fair dice rolls: I generate 60 dice rolls in the first data set and 600 in the second. For each generated data sets I then computed the p-value in two ways



                1) pooling the two data sets and then calculating a $chi^2_5$ statistic and p-value, and



                2) calculating a $chi^2$ statistic for both data sets, adding them together, and calculating the p-value using the $chi^2_{10}$ distribution.



                The joint p-values from the two is shown below.
                Pooled p-value vs added p-value
                You can see that it's possible for the added p-value to be very low while the pooled p-value is quite high - one point is an extreme version of the problem that you presented, with two data sets showing very different un-uniform distributions being merged together to form a uniform distribution. Because these deviations from the uniform distributions can cancel each other out, personally I would choose the method that you suggested - pooling the data first and then comparing it to a $chi^2_5$ distribution. Also, the $chi^2$ distribution approximation is more accurate for large data sets (Pearson's $chi^2$ statistic better approximates a true $chi^2$ distribution as the sample size grows).



                Here is the code that I used to generate the plot:



                set.seed(1)
                n1 = 60
                n2 = 600
                N = 10000
                pooledPvals = numeric(N)
                addedPvals = numeric(N)

                for (i in 1:N) {
                r1 = table(sample(6, n1, replace = TRUE))
                r2 = table(sample(6, n2, replace = TRUE))

                pooledPvals[i] = chisq.test(r1 + r2)$p.value
                addedPvals[i] = pchisq(chisq.test(r1)$
                statistic + chisq.test(r2)$statistic,
                df = 10, lower.tail = FALSE)
                }
                plot(addedPvals, pooledPvals,
                xlab = "Method 2 p-value (added)", ylab = "Method 1 p-value (pooled)")





                share|cite|improve this answer











                $endgroup$



                Both methods are acceptable. Under the null hypothesis, the frequency table made by pooling the two frequency tables together can be used to compute a $chi^2_{5}$ statistic. And the method that the author suggests is also correct - under the null hypothesis the sum of the $chi^2_5$ statistics will have a $chi^2_{10}$ distribution.



                Your question is an interesting example for comparing the two methods because the methods give quite different results. In Table 4A, it seems like there is significant evidence that $3$ and $4$ are the most likely and and that $1$ is the least likely. However Table 4C suggests a completely different distribution: $5$ is the most likely and $4$ is the least likely. By adding the $chi^2$ statistics together we get a significant result but the large $chi^2$ statistics are suggested by different deviations from the uniform distribution. If we create the pooled frequency table then the distribution is more uniform - the $chi^2_5$ statistic is $7.7$, giving a p-value of $0.17$.



                I've done some simulations of data generated by fair dice rolls: I generate 60 dice rolls in the first data set and 600 in the second. For each generated data sets I then computed the p-value in two ways



                1) pooling the two data sets and then calculating a $chi^2_5$ statistic and p-value, and



                2) calculating a $chi^2$ statistic for both data sets, adding them together, and calculating the p-value using the $chi^2_{10}$ distribution.



                The joint p-values from the two is shown below.
                Pooled p-value vs added p-value
                You can see that it's possible for the added p-value to be very low while the pooled p-value is quite high - one point is an extreme version of the problem that you presented, with two data sets showing very different un-uniform distributions being merged together to form a uniform distribution. Because these deviations from the uniform distributions can cancel each other out, personally I would choose the method that you suggested - pooling the data first and then comparing it to a $chi^2_5$ distribution. Also, the $chi^2$ distribution approximation is more accurate for large data sets (Pearson's $chi^2$ statistic better approximates a true $chi^2$ distribution as the sample size grows).



                Here is the code that I used to generate the plot:



                set.seed(1)
                n1 = 60
                n2 = 600
                N = 10000
                pooledPvals = numeric(N)
                addedPvals = numeric(N)

                for (i in 1:N) {
                r1 = table(sample(6, n1, replace = TRUE))
                r2 = table(sample(6, n2, replace = TRUE))

                pooledPvals[i] = chisq.test(r1 + r2)$p.value
                addedPvals[i] = pchisq(chisq.test(r1)$
                statistic + chisq.test(r2)$statistic,
                df = 10, lower.tail = FALSE)
                }
                plot(addedPvals, pooledPvals,
                xlab = "Method 2 p-value (added)", ylab = "Method 1 p-value (pooled)")






                share|cite|improve this answer














                share|cite|improve this answer



                share|cite|improve this answer








                edited Dec 15 '18 at 9:44

























                answered Dec 14 '18 at 18:13









                AlexAlex

                659412




                659412






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematics Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3033702%2fcombining-chi-square-charecterisitc%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Ellipse (mathématiques)

                    Quarter-circle Tiles

                    Mont Emei