How to find a confidence interval of a binomial distribution using a simulated random sample? ...

Inductor and Capacitor in Parallel

Is it convenient to ask the journal's editor for two additional days to complete a review?

Is there an equivalent of cd - for cp or mv

Why is information "lost" when it got into a black hole?

Plausibility of squid whales

What CSS properties can the br tag have?

What difference does it make using sed with/without whitespaces?

how one can write a nice vector parser, something that does pgfvecparse{A=B-C; D=E x F;}

The Ultimate Number Sequence Puzzle

Is it ok to trim down a tube patch?

My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?

Audio Conversion With ADS1243

How to avoid supervisors with prejudiced views?

Is there a difference between "Fahrstuhl" and "Aufzug"?

Asymptote: 3d graph over a disc

From jafe to El-Guest

(How) Could a medieval fantasy world survive a magic-induced "nuclear winter"?

How to use ReplaceAll on an expression that contains a rule

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

How to Implement Deterministic Encryption Safely in .NET

Do scriptures give a method to recognize a truly self-realized person/jivanmukta?

Can Sneak Attack be used when hitting with an improvised weapon?

Why am I getting "Static method cannot be referenced from a non static context: String String.valueOf(Object)"?

Is it correct to say moon starry nights?



How to find a confidence interval of a binomial distribution using a simulated random sample?



The Next CEO of Stack OverflowHow to calculate a confidence interval for $p$, the parameter of the binomial distribution?Uniform Distribution vs Exponential Distribution + Confidence intervalHow to find the confidence interval without the variance?Finding confidence interval for a binomial process using the normal distribution?Confidence interval of a binomial distribution?Confidence interval for sampleObtain a $(1-alpha) 100$% confidence interval for $theta$ using the moment estimatorHypothesis testing using the 95% Confidence Interval of Sample MeanIs Confidence Interval taken on one Random Sample or A Sampling DistributionBinomial distribution confidence interval using a random sample?












0












$begingroup$


I have a random sample of 1000 values of deviates from binomial distribution with n = 52 and p^
So I have 1000 values from the distribution.



How can I find a 95% confidence interval for the true value of p? (Without using normal distribution approximations).



It seems I just have random values as a sample to find two values from within which have a 95% probability of containing p?










share|cite|improve this question











$endgroup$

















    0












    $begingroup$


    I have a random sample of 1000 values of deviates from binomial distribution with n = 52 and p^
    So I have 1000 values from the distribution.



    How can I find a 95% confidence interval for the true value of p? (Without using normal distribution approximations).



    It seems I just have random values as a sample to find two values from within which have a 95% probability of containing p?










    share|cite|improve this question











    $endgroup$















      0












      0








      0





      $begingroup$


      I have a random sample of 1000 values of deviates from binomial distribution with n = 52 and p^
      So I have 1000 values from the distribution.



      How can I find a 95% confidence interval for the true value of p? (Without using normal distribution approximations).



      It seems I just have random values as a sample to find two values from within which have a 95% probability of containing p?










      share|cite|improve this question











      $endgroup$




      I have a random sample of 1000 values of deviates from binomial distribution with n = 52 and p^
      So I have 1000 values from the distribution.



      How can I find a 95% confidence interval for the true value of p? (Without using normal distribution approximations).



      It seems I just have random values as a sample to find two values from within which have a 95% probability of containing p?







      statistics statistical-inference binomial-distribution






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Mar 19 at 15:56







      Pumpkinpeach

















      asked Mar 17 at 17:46









      PumpkinpeachPumpkinpeach

      578




      578






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          By p^, I assume you mean $hat p = 44/52,$ the estimate of the cure rate $p$ as found in the experiment done by the manufacturer of the new drug.



          In R, $B = 1000$ observations from $mathsf{Binom}(n=52,, p = 44/52)$ are generated as follows:



          set.seed(2019);  x = rbinom(1000, 52, 44/52)


          Then we see that (a centrally located) 95% of the values $x/52$ lie
          within the interval $(0.73, 0.94).$



          set.seed(318);  x = rbinom(1000, 52, 44/52)
          quantile(x/52, c(.025, .975))
          2.5% 97.5%
          0.7307692 0.9423077


          This is close to the same interval we get with
          the Wald 95% confidence interval $hat p pm 1.96sqrt{frac{hat p(1-hat p)}{52}},$ which
          amounts to $(0.748, 0.944).$



          p.est = 44/52;  pm=c(-1,1) 
          p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
          [1] 0.7480870 0.9442207




          Notes: (1) Of course, without simulation, we could have obtained a more accurate version of the first
          interval in R, using the
          quantile function (inverse CDF) of the appropriate
          binomial distribution.



          qbinom(c(.025,.975), 52, 44/52)/52
          [1] 0.7500000 0.9423077


          (2) Especially for $n$ as small as 52, the Agresti-Coull ("plus four") CI has better coverage properties than the (asymptotic) Wald interval. Perhaps see this Q & A.



          n = 56; p.est = 46/n;  pm=c(-1,1) 
          p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
          [1] 0.7173299 0.9255273





          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%2f3151825%2fhow-to-find-a-confidence-interval-of-a-binomial-distribution-using-a-simulated-r%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









            0












            $begingroup$

            By p^, I assume you mean $hat p = 44/52,$ the estimate of the cure rate $p$ as found in the experiment done by the manufacturer of the new drug.



            In R, $B = 1000$ observations from $mathsf{Binom}(n=52,, p = 44/52)$ are generated as follows:



            set.seed(2019);  x = rbinom(1000, 52, 44/52)


            Then we see that (a centrally located) 95% of the values $x/52$ lie
            within the interval $(0.73, 0.94).$



            set.seed(318);  x = rbinom(1000, 52, 44/52)
            quantile(x/52, c(.025, .975))
            2.5% 97.5%
            0.7307692 0.9423077


            This is close to the same interval we get with
            the Wald 95% confidence interval $hat p pm 1.96sqrt{frac{hat p(1-hat p)}{52}},$ which
            amounts to $(0.748, 0.944).$



            p.est = 44/52;  pm=c(-1,1) 
            p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
            [1] 0.7480870 0.9442207




            Notes: (1) Of course, without simulation, we could have obtained a more accurate version of the first
            interval in R, using the
            quantile function (inverse CDF) of the appropriate
            binomial distribution.



            qbinom(c(.025,.975), 52, 44/52)/52
            [1] 0.7500000 0.9423077


            (2) Especially for $n$ as small as 52, the Agresti-Coull ("plus four") CI has better coverage properties than the (asymptotic) Wald interval. Perhaps see this Q & A.



            n = 56; p.est = 46/n;  pm=c(-1,1) 
            p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
            [1] 0.7173299 0.9255273





            share|cite|improve this answer











            $endgroup$


















              0












              $begingroup$

              By p^, I assume you mean $hat p = 44/52,$ the estimate of the cure rate $p$ as found in the experiment done by the manufacturer of the new drug.



              In R, $B = 1000$ observations from $mathsf{Binom}(n=52,, p = 44/52)$ are generated as follows:



              set.seed(2019);  x = rbinom(1000, 52, 44/52)


              Then we see that (a centrally located) 95% of the values $x/52$ lie
              within the interval $(0.73, 0.94).$



              set.seed(318);  x = rbinom(1000, 52, 44/52)
              quantile(x/52, c(.025, .975))
              2.5% 97.5%
              0.7307692 0.9423077


              This is close to the same interval we get with
              the Wald 95% confidence interval $hat p pm 1.96sqrt{frac{hat p(1-hat p)}{52}},$ which
              amounts to $(0.748, 0.944).$



              p.est = 44/52;  pm=c(-1,1) 
              p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
              [1] 0.7480870 0.9442207




              Notes: (1) Of course, without simulation, we could have obtained a more accurate version of the first
              interval in R, using the
              quantile function (inverse CDF) of the appropriate
              binomial distribution.



              qbinom(c(.025,.975), 52, 44/52)/52
              [1] 0.7500000 0.9423077


              (2) Especially for $n$ as small as 52, the Agresti-Coull ("plus four") CI has better coverage properties than the (asymptotic) Wald interval. Perhaps see this Q & A.



              n = 56; p.est = 46/n;  pm=c(-1,1) 
              p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
              [1] 0.7173299 0.9255273





              share|cite|improve this answer











              $endgroup$
















                0












                0








                0





                $begingroup$

                By p^, I assume you mean $hat p = 44/52,$ the estimate of the cure rate $p$ as found in the experiment done by the manufacturer of the new drug.



                In R, $B = 1000$ observations from $mathsf{Binom}(n=52,, p = 44/52)$ are generated as follows:



                set.seed(2019);  x = rbinom(1000, 52, 44/52)


                Then we see that (a centrally located) 95% of the values $x/52$ lie
                within the interval $(0.73, 0.94).$



                set.seed(318);  x = rbinom(1000, 52, 44/52)
                quantile(x/52, c(.025, .975))
                2.5% 97.5%
                0.7307692 0.9423077


                This is close to the same interval we get with
                the Wald 95% confidence interval $hat p pm 1.96sqrt{frac{hat p(1-hat p)}{52}},$ which
                amounts to $(0.748, 0.944).$



                p.est = 44/52;  pm=c(-1,1) 
                p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
                [1] 0.7480870 0.9442207




                Notes: (1) Of course, without simulation, we could have obtained a more accurate version of the first
                interval in R, using the
                quantile function (inverse CDF) of the appropriate
                binomial distribution.



                qbinom(c(.025,.975), 52, 44/52)/52
                [1] 0.7500000 0.9423077


                (2) Especially for $n$ as small as 52, the Agresti-Coull ("plus four") CI has better coverage properties than the (asymptotic) Wald interval. Perhaps see this Q & A.



                n = 56; p.est = 46/n;  pm=c(-1,1) 
                p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
                [1] 0.7173299 0.9255273





                share|cite|improve this answer











                $endgroup$



                By p^, I assume you mean $hat p = 44/52,$ the estimate of the cure rate $p$ as found in the experiment done by the manufacturer of the new drug.



                In R, $B = 1000$ observations from $mathsf{Binom}(n=52,, p = 44/52)$ are generated as follows:



                set.seed(2019);  x = rbinom(1000, 52, 44/52)


                Then we see that (a centrally located) 95% of the values $x/52$ lie
                within the interval $(0.73, 0.94).$



                set.seed(318);  x = rbinom(1000, 52, 44/52)
                quantile(x/52, c(.025, .975))
                2.5% 97.5%
                0.7307692 0.9423077


                This is close to the same interval we get with
                the Wald 95% confidence interval $hat p pm 1.96sqrt{frac{hat p(1-hat p)}{52}},$ which
                amounts to $(0.748, 0.944).$



                p.est = 44/52;  pm=c(-1,1) 
                p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
                [1] 0.7480870 0.9442207




                Notes: (1) Of course, without simulation, we could have obtained a more accurate version of the first
                interval in R, using the
                quantile function (inverse CDF) of the appropriate
                binomial distribution.



                qbinom(c(.025,.975), 52, 44/52)/52
                [1] 0.7500000 0.9423077


                (2) Especially for $n$ as small as 52, the Agresti-Coull ("plus four") CI has better coverage properties than the (asymptotic) Wald interval. Perhaps see this Q & A.



                n = 56; p.est = 46/n;  pm=c(-1,1) 
                p.est + pm*1.96*sqrt(p.est*(1-p.est)/52)
                [1] 0.7173299 0.9255273






                share|cite|improve this answer














                share|cite|improve this answer



                share|cite|improve this answer








                edited Mar 18 at 23:11

























                answered Mar 18 at 22:37









                BruceETBruceET

                36.2k71540




                36.2k71540






























                    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%2f3151825%2fhow-to-find-a-confidence-interval-of-a-binomial-distribution-using-a-simulated-r%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

                    Nidaros erkebispedøme

                    Birsay

                    Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?