can pvclust combine not variables,but obs. in R










1















Let's take it as example



library("MASS")
library("pvclust")
result.par <- pvclust(Boston, nboot=1000, parallel=TRUE)
plot(result.par)


We see that pvclust combines variables.
Is it possible to combine observation in clusters



ie. i want output (with cluster var)



 id crim zn indus chas nox rm age dis rad tax ptratio black lstat medv cluster
1 1 0.00632 18.0 2.31 0 0.538 6.575 65.2 4.0900 1 296 15.3 396.90 4.98 24.0 1
2 2 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.90 9.14 21.6 2
3 3 0.02729 0.0 7.07 0 0.469 7.185 61.1 4.9671 2 242 17.8 392.83 4.03 34.7 1
4 4 0.03237 0.0 2.18 0 0.458 6.998 45.8 6.0622 3 222 18.7 394.63 2.94 33.4 2
5 5 0.06905 0.0 2.18 0 0.458 7.147 54.2 6.0622 3 222 18.7 396.90 5.33 36.2 3
6 6 0.02985 0.0 2.18 0 0.458 6.430 58.7 6.0622 3 222 18.7 394.12 5.21 28.7 3
7 7 0.08829 12.5 7.87 0 0.524 6.012 66.6 5.5605 5 311 15.2 395.60 12.43 22.9 1
8 8 0.14455 12.5 7.87 0 0.524 6.172 96.1 5.9505 5 311 15.2 396.90 19.15 27.1 1
9 9 0.21124 12.5 7.87 0 0.524 5.631 100.0 6.0821 5 311 15.2 386.63 29.93 16.5 2
10 10 0.17004 12.5 7.87 0 0.524 6.004 85.9 6.5921 5 311 15.2 386.71 17.10 18.9 2


how to assing clusters to the obzervations










share|improve this question


























    1















    Let's take it as example



    library("MASS")
    library("pvclust")
    result.par <- pvclust(Boston, nboot=1000, parallel=TRUE)
    plot(result.par)


    We see that pvclust combines variables.
    Is it possible to combine observation in clusters



    ie. i want output (with cluster var)



     id crim zn indus chas nox rm age dis rad tax ptratio black lstat medv cluster
    1 1 0.00632 18.0 2.31 0 0.538 6.575 65.2 4.0900 1 296 15.3 396.90 4.98 24.0 1
    2 2 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.90 9.14 21.6 2
    3 3 0.02729 0.0 7.07 0 0.469 7.185 61.1 4.9671 2 242 17.8 392.83 4.03 34.7 1
    4 4 0.03237 0.0 2.18 0 0.458 6.998 45.8 6.0622 3 222 18.7 394.63 2.94 33.4 2
    5 5 0.06905 0.0 2.18 0 0.458 7.147 54.2 6.0622 3 222 18.7 396.90 5.33 36.2 3
    6 6 0.02985 0.0 2.18 0 0.458 6.430 58.7 6.0622 3 222 18.7 394.12 5.21 28.7 3
    7 7 0.08829 12.5 7.87 0 0.524 6.012 66.6 5.5605 5 311 15.2 395.60 12.43 22.9 1
    8 8 0.14455 12.5 7.87 0 0.524 6.172 96.1 5.9505 5 311 15.2 396.90 19.15 27.1 1
    9 9 0.21124 12.5 7.87 0 0.524 5.631 100.0 6.0821 5 311 15.2 386.63 29.93 16.5 2
    10 10 0.17004 12.5 7.87 0 0.524 6.004 85.9 6.5921 5 311 15.2 386.71 17.10 18.9 2


    how to assing clusters to the obzervations










    share|improve this question
























      1












      1








      1








      Let's take it as example



      library("MASS")
      library("pvclust")
      result.par <- pvclust(Boston, nboot=1000, parallel=TRUE)
      plot(result.par)


      We see that pvclust combines variables.
      Is it possible to combine observation in clusters



      ie. i want output (with cluster var)



       id crim zn indus chas nox rm age dis rad tax ptratio black lstat medv cluster
      1 1 0.00632 18.0 2.31 0 0.538 6.575 65.2 4.0900 1 296 15.3 396.90 4.98 24.0 1
      2 2 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.90 9.14 21.6 2
      3 3 0.02729 0.0 7.07 0 0.469 7.185 61.1 4.9671 2 242 17.8 392.83 4.03 34.7 1
      4 4 0.03237 0.0 2.18 0 0.458 6.998 45.8 6.0622 3 222 18.7 394.63 2.94 33.4 2
      5 5 0.06905 0.0 2.18 0 0.458 7.147 54.2 6.0622 3 222 18.7 396.90 5.33 36.2 3
      6 6 0.02985 0.0 2.18 0 0.458 6.430 58.7 6.0622 3 222 18.7 394.12 5.21 28.7 3
      7 7 0.08829 12.5 7.87 0 0.524 6.012 66.6 5.5605 5 311 15.2 395.60 12.43 22.9 1
      8 8 0.14455 12.5 7.87 0 0.524 6.172 96.1 5.9505 5 311 15.2 396.90 19.15 27.1 1
      9 9 0.21124 12.5 7.87 0 0.524 5.631 100.0 6.0821 5 311 15.2 386.63 29.93 16.5 2
      10 10 0.17004 12.5 7.87 0 0.524 6.004 85.9 6.5921 5 311 15.2 386.71 17.10 18.9 2


      how to assing clusters to the obzervations










      share|improve this question














      Let's take it as example



      library("MASS")
      library("pvclust")
      result.par <- pvclust(Boston, nboot=1000, parallel=TRUE)
      plot(result.par)


      We see that pvclust combines variables.
      Is it possible to combine observation in clusters



      ie. i want output (with cluster var)



       id crim zn indus chas nox rm age dis rad tax ptratio black lstat medv cluster
      1 1 0.00632 18.0 2.31 0 0.538 6.575 65.2 4.0900 1 296 15.3 396.90 4.98 24.0 1
      2 2 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.90 9.14 21.6 2
      3 3 0.02729 0.0 7.07 0 0.469 7.185 61.1 4.9671 2 242 17.8 392.83 4.03 34.7 1
      4 4 0.03237 0.0 2.18 0 0.458 6.998 45.8 6.0622 3 222 18.7 394.63 2.94 33.4 2
      5 5 0.06905 0.0 2.18 0 0.458 7.147 54.2 6.0622 3 222 18.7 396.90 5.33 36.2 3
      6 6 0.02985 0.0 2.18 0 0.458 6.430 58.7 6.0622 3 222 18.7 394.12 5.21 28.7 3
      7 7 0.08829 12.5 7.87 0 0.524 6.012 66.6 5.5605 5 311 15.2 395.60 12.43 22.9 1
      8 8 0.14455 12.5 7.87 0 0.524 6.172 96.1 5.9505 5 311 15.2 396.90 19.15 27.1 1
      9 9 0.21124 12.5 7.87 0 0.524 5.631 100.0 6.0821 5 311 15.2 386.63 29.93 16.5 2
      10 10 0.17004 12.5 7.87 0 0.524 6.004 85.9 6.5921 5 311 15.2 386.71 17.10 18.9 2


      how to assing clusters to the obzervations







      r pvclust






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 19:05









      D.JoeD.Joe

      6331616




      6331616






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Mclust function from mclust package is a valuable option.



          library("MASS")
          library("mclust")
          result.par <- Mclust(Boston)
          head(cbind(Boston, cluster=result.par$classification))


          https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html



          You can also visualize your cluster by removing dendrogram by rows and clustering only features for easiness of visualization. Mclust perform mixture model clustering, so things should change a bit compared to hierarchical clustering approaches.



          library(NMF)
          aheatmap(as.matrix(Boston_2[,-15]), # remove cluster from data
          annRow = as.character(Boston_2[,15]), # consider cluster for annotating rows
          Rowv = NA)


          enter image description here






          share|improve this answer

























          • very good, but how can i draw dendgrogram for these clusters?

            – D.Joe
            Nov 15 '18 at 10:04






          • 1





            I have updated the answer.

            – paoloeusebi
            Nov 15 '18 at 12:22










          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%2f53307146%2fcan-pvclust-combine-not-variables-but-obs-in-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









          1














          Mclust function from mclust package is a valuable option.



          library("MASS")
          library("mclust")
          result.par <- Mclust(Boston)
          head(cbind(Boston, cluster=result.par$classification))


          https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html



          You can also visualize your cluster by removing dendrogram by rows and clustering only features for easiness of visualization. Mclust perform mixture model clustering, so things should change a bit compared to hierarchical clustering approaches.



          library(NMF)
          aheatmap(as.matrix(Boston_2[,-15]), # remove cluster from data
          annRow = as.character(Boston_2[,15]), # consider cluster for annotating rows
          Rowv = NA)


          enter image description here






          share|improve this answer

























          • very good, but how can i draw dendgrogram for these clusters?

            – D.Joe
            Nov 15 '18 at 10:04






          • 1





            I have updated the answer.

            – paoloeusebi
            Nov 15 '18 at 12:22















          1














          Mclust function from mclust package is a valuable option.



          library("MASS")
          library("mclust")
          result.par <- Mclust(Boston)
          head(cbind(Boston, cluster=result.par$classification))


          https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html



          You can also visualize your cluster by removing dendrogram by rows and clustering only features for easiness of visualization. Mclust perform mixture model clustering, so things should change a bit compared to hierarchical clustering approaches.



          library(NMF)
          aheatmap(as.matrix(Boston_2[,-15]), # remove cluster from data
          annRow = as.character(Boston_2[,15]), # consider cluster for annotating rows
          Rowv = NA)


          enter image description here






          share|improve this answer

























          • very good, but how can i draw dendgrogram for these clusters?

            – D.Joe
            Nov 15 '18 at 10:04






          • 1





            I have updated the answer.

            – paoloeusebi
            Nov 15 '18 at 12:22













          1












          1








          1







          Mclust function from mclust package is a valuable option.



          library("MASS")
          library("mclust")
          result.par <- Mclust(Boston)
          head(cbind(Boston, cluster=result.par$classification))


          https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html



          You can also visualize your cluster by removing dendrogram by rows and clustering only features for easiness of visualization. Mclust perform mixture model clustering, so things should change a bit compared to hierarchical clustering approaches.



          library(NMF)
          aheatmap(as.matrix(Boston_2[,-15]), # remove cluster from data
          annRow = as.character(Boston_2[,15]), # consider cluster for annotating rows
          Rowv = NA)


          enter image description here






          share|improve this answer















          Mclust function from mclust package is a valuable option.



          library("MASS")
          library("mclust")
          result.par <- Mclust(Boston)
          head(cbind(Boston, cluster=result.par$classification))


          https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html



          You can also visualize your cluster by removing dendrogram by rows and clustering only features for easiness of visualization. Mclust perform mixture model clustering, so things should change a bit compared to hierarchical clustering approaches.



          library(NMF)
          aheatmap(as.matrix(Boston_2[,-15]), # remove cluster from data
          annRow = as.character(Boston_2[,15]), # consider cluster for annotating rows
          Rowv = NA)


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 '18 at 12:19

























          answered Nov 15 '18 at 2:27









          paoloeusebipaoloeusebi

          641414




          641414












          • very good, but how can i draw dendgrogram for these clusters?

            – D.Joe
            Nov 15 '18 at 10:04






          • 1





            I have updated the answer.

            – paoloeusebi
            Nov 15 '18 at 12:22

















          • very good, but how can i draw dendgrogram for these clusters?

            – D.Joe
            Nov 15 '18 at 10:04






          • 1





            I have updated the answer.

            – paoloeusebi
            Nov 15 '18 at 12:22
















          very good, but how can i draw dendgrogram for these clusters?

          – D.Joe
          Nov 15 '18 at 10:04





          very good, but how can i draw dendgrogram for these clusters?

          – D.Joe
          Nov 15 '18 at 10:04




          1




          1





          I have updated the answer.

          – paoloeusebi
          Nov 15 '18 at 12:22





          I have updated the answer.

          – paoloeusebi
          Nov 15 '18 at 12:22



















          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%2f53307146%2fcan-pvclust-combine-not-variables-but-obs-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

          Darth Vader #20

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Ondo