Creating a beta distribution Q-Q plot [R]










2















My task is to create 100 random generated numbers from beta distribution and compare that random variable with beta distribution using quantile plot.

This is my attempt:



library(MASS)
library(qualityTools)
Random_Numbers_Beta <- rbeta(100, 1, 1)
qqPlot(Random_Numbers_Beta, "beta", list(shape = 1, rate = 1))


Unfortunately something is wrong. This is an error which occurs:



Error in (function (x, densfun, start, ...) : 
'start' must be a named list


Can something be done with that issue?










share|improve this question




























    2















    My task is to create 100 random generated numbers from beta distribution and compare that random variable with beta distribution using quantile plot.

    This is my attempt:



    library(MASS)
    library(qualityTools)
    Random_Numbers_Beta <- rbeta(100, 1, 1)
    qqPlot(Random_Numbers_Beta, "beta", list(shape = 1, rate = 1))


    Unfortunately something is wrong. This is an error which occurs:



    Error in (function (x, densfun, start, ...) : 
    'start' must be a named list


    Can something be done with that issue?










    share|improve this question


























      2












      2








      2








      My task is to create 100 random generated numbers from beta distribution and compare that random variable with beta distribution using quantile plot.

      This is my attempt:



      library(MASS)
      library(qualityTools)
      Random_Numbers_Beta <- rbeta(100, 1, 1)
      qqPlot(Random_Numbers_Beta, "beta", list(shape = 1, rate = 1))


      Unfortunately something is wrong. This is an error which occurs:



      Error in (function (x, densfun, start, ...) : 
      'start' must be a named list


      Can something be done with that issue?










      share|improve this question
















      My task is to create 100 random generated numbers from beta distribution and compare that random variable with beta distribution using quantile plot.

      This is my attempt:



      library(MASS)
      library(qualityTools)
      Random_Numbers_Beta <- rbeta(100, 1, 1)
      qqPlot(Random_Numbers_Beta, "beta", list(shape = 1, rate = 1))


      Unfortunately something is wrong. This is an error which occurs:



      Error in (function (x, densfun, start, ...) : 
      'start' must be a named list


      Can something be done with that issue?







      r






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 '18 at 0:00







      Hendrra

















      asked Nov 10 '18 at 22:09









      HendrraHendrra

      215110




      215110






















          1 Answer
          1






          active

          oldest

          votes


















          3














          First, you had to specify that list(shape = 1, rate = 1) is the start parameter; right now this list is being treated as a value for the confbounds parameter. Second, it's actually not shape and rate, but shape1 and shape2, as in, e.g., ?dbeta.



          qqPlot(Random_Numbers_Beta, "beta", start = list(shape1 = 1, shape2 = 1))


          enter image description here



          Again inspecting ?qqPlot you may see that ... is for "further graphical parameters: (see par)." Hence, you may modify the plot the way you like; e.g., adding col = 'red'.



          Also notice that Beta(1,1) is simply the uniform distribution on [0,1] and, hence, its quantile function is the identity function. That is, qbeta(x, 1, 1) == x for any x in [0,1]. So, you may also simply work directly with



          x <- seq(0, 1, length = 500)
          plot(quantile(Random_Numbers_Beta, x), x)
          abline(a = 0, b = 1, col = 'red')


          enter image description here



          if you don't need the confidence bounds.




          One can notice, however, that the two plots are a little different. Given your task, it would seem that you need the second one.



          In the first one, it looks like qqPlot fits a beta distribution for your data and uses its quantiles, which apparently isn't exactly the identity function. That is, it doesn't use the exact knowledge about the parameters. The second plot uses this knowledge.






          share|improve this answer

























          • Thank you! Your post is very helpful. Is it possible to change the look of the dots?

            – Hendrra
            Nov 10 '18 at 22:22






          • 1





            @Hendrra, certainly, see the update.

            – Julius Vainora
            Nov 10 '18 at 22:31






          • 1





            @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

            – Julius Vainora
            Nov 10 '18 at 22:40











          • Your comment is really useful. Thank you! It's true that I haven't noticed it.

            – Hendrra
            Nov 10 '18 at 22:47











          • In a similar task for normal and exponential distribution can I use identity function too?

            – Hendrra
            Nov 10 '18 at 22:52










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243919%2fcreating-a-beta-distribution-q-q-plot-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









          3














          First, you had to specify that list(shape = 1, rate = 1) is the start parameter; right now this list is being treated as a value for the confbounds parameter. Second, it's actually not shape and rate, but shape1 and shape2, as in, e.g., ?dbeta.



          qqPlot(Random_Numbers_Beta, "beta", start = list(shape1 = 1, shape2 = 1))


          enter image description here



          Again inspecting ?qqPlot you may see that ... is for "further graphical parameters: (see par)." Hence, you may modify the plot the way you like; e.g., adding col = 'red'.



          Also notice that Beta(1,1) is simply the uniform distribution on [0,1] and, hence, its quantile function is the identity function. That is, qbeta(x, 1, 1) == x for any x in [0,1]. So, you may also simply work directly with



          x <- seq(0, 1, length = 500)
          plot(quantile(Random_Numbers_Beta, x), x)
          abline(a = 0, b = 1, col = 'red')


          enter image description here



          if you don't need the confidence bounds.




          One can notice, however, that the two plots are a little different. Given your task, it would seem that you need the second one.



          In the first one, it looks like qqPlot fits a beta distribution for your data and uses its quantiles, which apparently isn't exactly the identity function. That is, it doesn't use the exact knowledge about the parameters. The second plot uses this knowledge.






          share|improve this answer

























          • Thank you! Your post is very helpful. Is it possible to change the look of the dots?

            – Hendrra
            Nov 10 '18 at 22:22






          • 1





            @Hendrra, certainly, see the update.

            – Julius Vainora
            Nov 10 '18 at 22:31






          • 1





            @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

            – Julius Vainora
            Nov 10 '18 at 22:40











          • Your comment is really useful. Thank you! It's true that I haven't noticed it.

            – Hendrra
            Nov 10 '18 at 22:47











          • In a similar task for normal and exponential distribution can I use identity function too?

            – Hendrra
            Nov 10 '18 at 22:52















          3














          First, you had to specify that list(shape = 1, rate = 1) is the start parameter; right now this list is being treated as a value for the confbounds parameter. Second, it's actually not shape and rate, but shape1 and shape2, as in, e.g., ?dbeta.



          qqPlot(Random_Numbers_Beta, "beta", start = list(shape1 = 1, shape2 = 1))


          enter image description here



          Again inspecting ?qqPlot you may see that ... is for "further graphical parameters: (see par)." Hence, you may modify the plot the way you like; e.g., adding col = 'red'.



          Also notice that Beta(1,1) is simply the uniform distribution on [0,1] and, hence, its quantile function is the identity function. That is, qbeta(x, 1, 1) == x for any x in [0,1]. So, you may also simply work directly with



          x <- seq(0, 1, length = 500)
          plot(quantile(Random_Numbers_Beta, x), x)
          abline(a = 0, b = 1, col = 'red')


          enter image description here



          if you don't need the confidence bounds.




          One can notice, however, that the two plots are a little different. Given your task, it would seem that you need the second one.



          In the first one, it looks like qqPlot fits a beta distribution for your data and uses its quantiles, which apparently isn't exactly the identity function. That is, it doesn't use the exact knowledge about the parameters. The second plot uses this knowledge.






          share|improve this answer

























          • Thank you! Your post is very helpful. Is it possible to change the look of the dots?

            – Hendrra
            Nov 10 '18 at 22:22






          • 1





            @Hendrra, certainly, see the update.

            – Julius Vainora
            Nov 10 '18 at 22:31






          • 1





            @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

            – Julius Vainora
            Nov 10 '18 at 22:40











          • Your comment is really useful. Thank you! It's true that I haven't noticed it.

            – Hendrra
            Nov 10 '18 at 22:47











          • In a similar task for normal and exponential distribution can I use identity function too?

            – Hendrra
            Nov 10 '18 at 22:52













          3












          3








          3







          First, you had to specify that list(shape = 1, rate = 1) is the start parameter; right now this list is being treated as a value for the confbounds parameter. Second, it's actually not shape and rate, but shape1 and shape2, as in, e.g., ?dbeta.



          qqPlot(Random_Numbers_Beta, "beta", start = list(shape1 = 1, shape2 = 1))


          enter image description here



          Again inspecting ?qqPlot you may see that ... is for "further graphical parameters: (see par)." Hence, you may modify the plot the way you like; e.g., adding col = 'red'.



          Also notice that Beta(1,1) is simply the uniform distribution on [0,1] and, hence, its quantile function is the identity function. That is, qbeta(x, 1, 1) == x for any x in [0,1]. So, you may also simply work directly with



          x <- seq(0, 1, length = 500)
          plot(quantile(Random_Numbers_Beta, x), x)
          abline(a = 0, b = 1, col = 'red')


          enter image description here



          if you don't need the confidence bounds.




          One can notice, however, that the two plots are a little different. Given your task, it would seem that you need the second one.



          In the first one, it looks like qqPlot fits a beta distribution for your data and uses its quantiles, which apparently isn't exactly the identity function. That is, it doesn't use the exact knowledge about the parameters. The second plot uses this knowledge.






          share|improve this answer















          First, you had to specify that list(shape = 1, rate = 1) is the start parameter; right now this list is being treated as a value for the confbounds parameter. Second, it's actually not shape and rate, but shape1 and shape2, as in, e.g., ?dbeta.



          qqPlot(Random_Numbers_Beta, "beta", start = list(shape1 = 1, shape2 = 1))


          enter image description here



          Again inspecting ?qqPlot you may see that ... is for "further graphical parameters: (see par)." Hence, you may modify the plot the way you like; e.g., adding col = 'red'.



          Also notice that Beta(1,1) is simply the uniform distribution on [0,1] and, hence, its quantile function is the identity function. That is, qbeta(x, 1, 1) == x for any x in [0,1]. So, you may also simply work directly with



          x <- seq(0, 1, length = 500)
          plot(quantile(Random_Numbers_Beta, x), x)
          abline(a = 0, b = 1, col = 'red')


          enter image description here



          if you don't need the confidence bounds.




          One can notice, however, that the two plots are a little different. Given your task, it would seem that you need the second one.



          In the first one, it looks like qqPlot fits a beta distribution for your data and uses its quantiles, which apparently isn't exactly the identity function. That is, it doesn't use the exact knowledge about the parameters. The second plot uses this knowledge.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 10 '18 at 22:40

























          answered Nov 10 '18 at 22:15









          Julius VainoraJulius Vainora

          34.3k76079




          34.3k76079












          • Thank you! Your post is very helpful. Is it possible to change the look of the dots?

            – Hendrra
            Nov 10 '18 at 22:22






          • 1





            @Hendrra, certainly, see the update.

            – Julius Vainora
            Nov 10 '18 at 22:31






          • 1





            @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

            – Julius Vainora
            Nov 10 '18 at 22:40











          • Your comment is really useful. Thank you! It's true that I haven't noticed it.

            – Hendrra
            Nov 10 '18 at 22:47











          • In a similar task for normal and exponential distribution can I use identity function too?

            – Hendrra
            Nov 10 '18 at 22:52

















          • Thank you! Your post is very helpful. Is it possible to change the look of the dots?

            – Hendrra
            Nov 10 '18 at 22:22






          • 1





            @Hendrra, certainly, see the update.

            – Julius Vainora
            Nov 10 '18 at 22:31






          • 1





            @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

            – Julius Vainora
            Nov 10 '18 at 22:40











          • Your comment is really useful. Thank you! It's true that I haven't noticed it.

            – Hendrra
            Nov 10 '18 at 22:47











          • In a similar task for normal and exponential distribution can I use identity function too?

            – Hendrra
            Nov 10 '18 at 22:52
















          Thank you! Your post is very helpful. Is it possible to change the look of the dots?

          – Hendrra
          Nov 10 '18 at 22:22





          Thank you! Your post is very helpful. Is it possible to change the look of the dots?

          – Hendrra
          Nov 10 '18 at 22:22




          1




          1





          @Hendrra, certainly, see the update.

          – Julius Vainora
          Nov 10 '18 at 22:31





          @Hendrra, certainly, see the update.

          – Julius Vainora
          Nov 10 '18 at 22:31




          1




          1





          @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

          – Julius Vainora
          Nov 10 '18 at 22:40





          @Hendrra, also I added a comment about the choice of qqPlot, it may be not the right approach (given how you formulated your task).

          – Julius Vainora
          Nov 10 '18 at 22:40













          Your comment is really useful. Thank you! It's true that I haven't noticed it.

          – Hendrra
          Nov 10 '18 at 22:47





          Your comment is really useful. Thank you! It's true that I haven't noticed it.

          – Hendrra
          Nov 10 '18 at 22:47













          In a similar task for normal and exponential distribution can I use identity function too?

          – Hendrra
          Nov 10 '18 at 22:52





          In a similar task for normal and exponential distribution can I use identity function too?

          – Hendrra
          Nov 10 '18 at 22:52

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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.

          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%2fstackoverflow.com%2fquestions%2f53243919%2fcreating-a-beta-distribution-q-q-plot-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

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Edmonton

          Crossroads (UK TV series)