How to interpret a mosaic plot in R?












2














The mosaic plot shown bellow is the product of this code



mosaicplot(table(survey$Air,survey$Satisfaction),
main = "Satisfaction with Airconditioning and Overall Satisfaction")


Bear in mind that the satisfactions were coded as binary, where levels of satisfaction of 1,2,3 are coded as 0, and levels of satisfaction of 4,5 were coded as 1. I do not really know how to interpret the mosaic plot. Any help is appreciated! enter image description here










share|cite|improve this question









New contributor




Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    2














    The mosaic plot shown bellow is the product of this code



    mosaicplot(table(survey$Air,survey$Satisfaction),
    main = "Satisfaction with Airconditioning and Overall Satisfaction")


    Bear in mind that the satisfactions were coded as binary, where levels of satisfaction of 1,2,3 are coded as 0, and levels of satisfaction of 4,5 were coded as 1. I do not really know how to interpret the mosaic plot. Any help is appreciated! enter image description here










    share|cite|improve this question









    New contributor




    Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      2












      2








      2







      The mosaic plot shown bellow is the product of this code



      mosaicplot(table(survey$Air,survey$Satisfaction),
      main = "Satisfaction with Airconditioning and Overall Satisfaction")


      Bear in mind that the satisfactions were coded as binary, where levels of satisfaction of 1,2,3 are coded as 0, and levels of satisfaction of 4,5 were coded as 1. I do not really know how to interpret the mosaic plot. Any help is appreciated! enter image description here










      share|cite|improve this question









      New contributor




      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      The mosaic plot shown bellow is the product of this code



      mosaicplot(table(survey$Air,survey$Satisfaction),
      main = "Satisfaction with Airconditioning and Overall Satisfaction")


      Bear in mind that the satisfactions were coded as binary, where levels of satisfaction of 1,2,3 are coded as 0, and levels of satisfaction of 4,5 were coded as 1. I do not really know how to interpret the mosaic plot. Any help is appreciated! enter image description here







      r data-visualization inference interpretation






      share|cite|improve this question









      New contributor




      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|cite|improve this question









      New contributor




      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|cite|improve this question




      share|cite|improve this question








      edited Dec 30 '18 at 22:29





















      New contributor




      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Dec 30 '18 at 18:01









      Katarina

      235




      235




      New contributor




      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Katarina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          3














          A mosaic plot helps to visualize the statistical association between two categorical variables, in your case between having AC (0, 1) and high satisfaction (0, 1).




          1. The frequency distribution of the first variable (AC) is represented on the horizontal axis. The relative frequency of each factor level is proportional to the width of the corresponding segment on the x-axis. In your case, most observations are 0, so no AC was available. In pseudo-code, you would obtain the corresponding values by prop.table(table(AC))


          2. The joint frequency distribution (the relative frequencies of each combination of the two factors) is represented by the areas of the corresponding rectangles. In your case, there are many dissatisfied persons without AC. You would get these relative frequencies by table(AC, satisfaction).


          3. Within each level of the first variable, the frequency distribution of the second variable (satisfaction) is shown vertically. If these conditional distributions look similar, there is no or only a weak association between the two factors. If they look very different like in your case, you would speak of a clear association. In the no-AC group (the left vertical bar), a clear minority (about 10%) is satisfied. In the AC group (the right vertical bar), more than half of the persons were satisfied. In pseudo.code, you would get the corresponding proportions by prop.table(table(AC, satisfaction), margin = 1).



          Typically, the third information is usually the reason to look at a mosaic plot. The order of the variables is essential.






          share|cite|improve this answer

















          • 1




            Thank you for answering and explaining it in such a good manner!
            – Katarina
            Dec 30 '18 at 22:27



















          3














          A mosaic plot recursively partitions the area in the plot by the proportions of each margin conditional on all previous margins.




          1. Thus, the widths of the cells in the two columns corresponds to the first margin Air and shows that there were many respondents that had lower satisfaction with air conditioning (0) and only few with high satisfaction (1).

          2. The height of the cells correspond to the second margin Satisfaction and show the conditional proportion for overall satisfaction given satisfaction with air conditioning. This brings out clearly that those with low air conditioning satisfaction (left column) have a low overall satisfaction (lower left cell). In contrast, the proportion of high overall satisfaction (lower right cell) is much higher among those with high air conditioning satisfaction (right column).


          The plot can be enhanced by using a shading for the "dependent" variable (second split) but with zero spacing. Such a version is produced by the default plot() method if both Air and Satisfaction are coded as factor variables. Possibly reversing the order of the levels on the y axis might help. Try:



          plot(Satisfaction ~ Air, data = survey)
          plot(Satisfaction ~ Air, data = survey, ylevels = 2:1)


          (Had your example been reproducible, we could have shown you this in more detail.)






          share|cite|improve this answer

















          • 2




            Faster and more general than my answer (+1).
            – Michael M
            Dec 30 '18 at 19:39










          • Thank you very much for your answer, it was really helpful!
            – Katarina
            Dec 30 '18 at 22:26











          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: "65"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          });


          }
          });






          Katarina is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f384997%2fhow-to-interpret-a-mosaic-plot-in-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          A mosaic plot helps to visualize the statistical association between two categorical variables, in your case between having AC (0, 1) and high satisfaction (0, 1).




          1. The frequency distribution of the first variable (AC) is represented on the horizontal axis. The relative frequency of each factor level is proportional to the width of the corresponding segment on the x-axis. In your case, most observations are 0, so no AC was available. In pseudo-code, you would obtain the corresponding values by prop.table(table(AC))


          2. The joint frequency distribution (the relative frequencies of each combination of the two factors) is represented by the areas of the corresponding rectangles. In your case, there are many dissatisfied persons without AC. You would get these relative frequencies by table(AC, satisfaction).


          3. Within each level of the first variable, the frequency distribution of the second variable (satisfaction) is shown vertically. If these conditional distributions look similar, there is no or only a weak association between the two factors. If they look very different like in your case, you would speak of a clear association. In the no-AC group (the left vertical bar), a clear minority (about 10%) is satisfied. In the AC group (the right vertical bar), more than half of the persons were satisfied. In pseudo.code, you would get the corresponding proportions by prop.table(table(AC, satisfaction), margin = 1).



          Typically, the third information is usually the reason to look at a mosaic plot. The order of the variables is essential.






          share|cite|improve this answer

















          • 1




            Thank you for answering and explaining it in such a good manner!
            – Katarina
            Dec 30 '18 at 22:27
















          3














          A mosaic plot helps to visualize the statistical association between two categorical variables, in your case between having AC (0, 1) and high satisfaction (0, 1).




          1. The frequency distribution of the first variable (AC) is represented on the horizontal axis. The relative frequency of each factor level is proportional to the width of the corresponding segment on the x-axis. In your case, most observations are 0, so no AC was available. In pseudo-code, you would obtain the corresponding values by prop.table(table(AC))


          2. The joint frequency distribution (the relative frequencies of each combination of the two factors) is represented by the areas of the corresponding rectangles. In your case, there are many dissatisfied persons without AC. You would get these relative frequencies by table(AC, satisfaction).


          3. Within each level of the first variable, the frequency distribution of the second variable (satisfaction) is shown vertically. If these conditional distributions look similar, there is no or only a weak association between the two factors. If they look very different like in your case, you would speak of a clear association. In the no-AC group (the left vertical bar), a clear minority (about 10%) is satisfied. In the AC group (the right vertical bar), more than half of the persons were satisfied. In pseudo.code, you would get the corresponding proportions by prop.table(table(AC, satisfaction), margin = 1).



          Typically, the third information is usually the reason to look at a mosaic plot. The order of the variables is essential.






          share|cite|improve this answer

















          • 1




            Thank you for answering and explaining it in such a good manner!
            – Katarina
            Dec 30 '18 at 22:27














          3












          3








          3






          A mosaic plot helps to visualize the statistical association between two categorical variables, in your case between having AC (0, 1) and high satisfaction (0, 1).




          1. The frequency distribution of the first variable (AC) is represented on the horizontal axis. The relative frequency of each factor level is proportional to the width of the corresponding segment on the x-axis. In your case, most observations are 0, so no AC was available. In pseudo-code, you would obtain the corresponding values by prop.table(table(AC))


          2. The joint frequency distribution (the relative frequencies of each combination of the two factors) is represented by the areas of the corresponding rectangles. In your case, there are many dissatisfied persons without AC. You would get these relative frequencies by table(AC, satisfaction).


          3. Within each level of the first variable, the frequency distribution of the second variable (satisfaction) is shown vertically. If these conditional distributions look similar, there is no or only a weak association between the two factors. If they look very different like in your case, you would speak of a clear association. In the no-AC group (the left vertical bar), a clear minority (about 10%) is satisfied. In the AC group (the right vertical bar), more than half of the persons were satisfied. In pseudo.code, you would get the corresponding proportions by prop.table(table(AC, satisfaction), margin = 1).



          Typically, the third information is usually the reason to look at a mosaic plot. The order of the variables is essential.






          share|cite|improve this answer












          A mosaic plot helps to visualize the statistical association between two categorical variables, in your case between having AC (0, 1) and high satisfaction (0, 1).




          1. The frequency distribution of the first variable (AC) is represented on the horizontal axis. The relative frequency of each factor level is proportional to the width of the corresponding segment on the x-axis. In your case, most observations are 0, so no AC was available. In pseudo-code, you would obtain the corresponding values by prop.table(table(AC))


          2. The joint frequency distribution (the relative frequencies of each combination of the two factors) is represented by the areas of the corresponding rectangles. In your case, there are many dissatisfied persons without AC. You would get these relative frequencies by table(AC, satisfaction).


          3. Within each level of the first variable, the frequency distribution of the second variable (satisfaction) is shown vertically. If these conditional distributions look similar, there is no or only a weak association between the two factors. If they look very different like in your case, you would speak of a clear association. In the no-AC group (the left vertical bar), a clear minority (about 10%) is satisfied. In the AC group (the right vertical bar), more than half of the persons were satisfied. In pseudo.code, you would get the corresponding proportions by prop.table(table(AC, satisfaction), margin = 1).



          Typically, the third information is usually the reason to look at a mosaic plot. The order of the variables is essential.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 30 '18 at 19:32









          Michael M

          6,15332035




          6,15332035








          • 1




            Thank you for answering and explaining it in such a good manner!
            – Katarina
            Dec 30 '18 at 22:27














          • 1




            Thank you for answering and explaining it in such a good manner!
            – Katarina
            Dec 30 '18 at 22:27








          1




          1




          Thank you for answering and explaining it in such a good manner!
          – Katarina
          Dec 30 '18 at 22:27




          Thank you for answering and explaining it in such a good manner!
          – Katarina
          Dec 30 '18 at 22:27













          3














          A mosaic plot recursively partitions the area in the plot by the proportions of each margin conditional on all previous margins.




          1. Thus, the widths of the cells in the two columns corresponds to the first margin Air and shows that there were many respondents that had lower satisfaction with air conditioning (0) and only few with high satisfaction (1).

          2. The height of the cells correspond to the second margin Satisfaction and show the conditional proportion for overall satisfaction given satisfaction with air conditioning. This brings out clearly that those with low air conditioning satisfaction (left column) have a low overall satisfaction (lower left cell). In contrast, the proportion of high overall satisfaction (lower right cell) is much higher among those with high air conditioning satisfaction (right column).


          The plot can be enhanced by using a shading for the "dependent" variable (second split) but with zero spacing. Such a version is produced by the default plot() method if both Air and Satisfaction are coded as factor variables. Possibly reversing the order of the levels on the y axis might help. Try:



          plot(Satisfaction ~ Air, data = survey)
          plot(Satisfaction ~ Air, data = survey, ylevels = 2:1)


          (Had your example been reproducible, we could have shown you this in more detail.)






          share|cite|improve this answer

















          • 2




            Faster and more general than my answer (+1).
            – Michael M
            Dec 30 '18 at 19:39










          • Thank you very much for your answer, it was really helpful!
            – Katarina
            Dec 30 '18 at 22:26
















          3














          A mosaic plot recursively partitions the area in the plot by the proportions of each margin conditional on all previous margins.




          1. Thus, the widths of the cells in the two columns corresponds to the first margin Air and shows that there were many respondents that had lower satisfaction with air conditioning (0) and only few with high satisfaction (1).

          2. The height of the cells correspond to the second margin Satisfaction and show the conditional proportion for overall satisfaction given satisfaction with air conditioning. This brings out clearly that those with low air conditioning satisfaction (left column) have a low overall satisfaction (lower left cell). In contrast, the proportion of high overall satisfaction (lower right cell) is much higher among those with high air conditioning satisfaction (right column).


          The plot can be enhanced by using a shading for the "dependent" variable (second split) but with zero spacing. Such a version is produced by the default plot() method if both Air and Satisfaction are coded as factor variables. Possibly reversing the order of the levels on the y axis might help. Try:



          plot(Satisfaction ~ Air, data = survey)
          plot(Satisfaction ~ Air, data = survey, ylevels = 2:1)


          (Had your example been reproducible, we could have shown you this in more detail.)






          share|cite|improve this answer

















          • 2




            Faster and more general than my answer (+1).
            – Michael M
            Dec 30 '18 at 19:39










          • Thank you very much for your answer, it was really helpful!
            – Katarina
            Dec 30 '18 at 22:26














          3












          3








          3






          A mosaic plot recursively partitions the area in the plot by the proportions of each margin conditional on all previous margins.




          1. Thus, the widths of the cells in the two columns corresponds to the first margin Air and shows that there were many respondents that had lower satisfaction with air conditioning (0) and only few with high satisfaction (1).

          2. The height of the cells correspond to the second margin Satisfaction and show the conditional proportion for overall satisfaction given satisfaction with air conditioning. This brings out clearly that those with low air conditioning satisfaction (left column) have a low overall satisfaction (lower left cell). In contrast, the proportion of high overall satisfaction (lower right cell) is much higher among those with high air conditioning satisfaction (right column).


          The plot can be enhanced by using a shading for the "dependent" variable (second split) but with zero spacing. Such a version is produced by the default plot() method if both Air and Satisfaction are coded as factor variables. Possibly reversing the order of the levels on the y axis might help. Try:



          plot(Satisfaction ~ Air, data = survey)
          plot(Satisfaction ~ Air, data = survey, ylevels = 2:1)


          (Had your example been reproducible, we could have shown you this in more detail.)






          share|cite|improve this answer












          A mosaic plot recursively partitions the area in the plot by the proportions of each margin conditional on all previous margins.




          1. Thus, the widths of the cells in the two columns corresponds to the first margin Air and shows that there were many respondents that had lower satisfaction with air conditioning (0) and only few with high satisfaction (1).

          2. The height of the cells correspond to the second margin Satisfaction and show the conditional proportion for overall satisfaction given satisfaction with air conditioning. This brings out clearly that those with low air conditioning satisfaction (left column) have a low overall satisfaction (lower left cell). In contrast, the proportion of high overall satisfaction (lower right cell) is much higher among those with high air conditioning satisfaction (right column).


          The plot can be enhanced by using a shading for the "dependent" variable (second split) but with zero spacing. Such a version is produced by the default plot() method if both Air and Satisfaction are coded as factor variables. Possibly reversing the order of the levels on the y axis might help. Try:



          plot(Satisfaction ~ Air, data = survey)
          plot(Satisfaction ~ Air, data = survey, ylevels = 2:1)


          (Had your example been reproducible, we could have shown you this in more detail.)







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 30 '18 at 19:25









          Achim Zeileis

          8,38011430




          8,38011430








          • 2




            Faster and more general than my answer (+1).
            – Michael M
            Dec 30 '18 at 19:39










          • Thank you very much for your answer, it was really helpful!
            – Katarina
            Dec 30 '18 at 22:26














          • 2




            Faster and more general than my answer (+1).
            – Michael M
            Dec 30 '18 at 19:39










          • Thank you very much for your answer, it was really helpful!
            – Katarina
            Dec 30 '18 at 22:26








          2




          2




          Faster and more general than my answer (+1).
          – Michael M
          Dec 30 '18 at 19:39




          Faster and more general than my answer (+1).
          – Michael M
          Dec 30 '18 at 19:39












          Thank you very much for your answer, it was really helpful!
          – Katarina
          Dec 30 '18 at 22:26




          Thank you very much for your answer, it was really helpful!
          – Katarina
          Dec 30 '18 at 22:26










          Katarina is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Katarina is a new contributor. Be nice, and check out our Code of Conduct.













          Katarina is a new contributor. Be nice, and check out our Code of Conduct.












          Katarina is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Cross Validated!


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





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2fstats.stackexchange.com%2fquestions%2f384997%2fhow-to-interpret-a-mosaic-plot-in-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

          Human spaceflight

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

          File:DeusFollowingSea.jpg