Is Spearman correlation never greater than Pearson correlation?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












If Spearman correlation is Pearson correlation, but on ranks of the data - does it mean that absolute Spearman will always be lower or equal to absolute Pearson correlation, but never greater? Is it possible to have variables that show greater absolute Spearman than absolute Pearson?



Example:



# Spearman == Pearson
# We're correlating ranked variables from the beginning
foo <- 1:1e3
bar <- 1:1e3
sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))

# Spearman < Pearson
foo <- rnorm(1e3)
bar <- rnorm(1e3)
sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))









share|cite|improve this question



























    up vote
    2
    down vote

    favorite












    If Spearman correlation is Pearson correlation, but on ranks of the data - does it mean that absolute Spearman will always be lower or equal to absolute Pearson correlation, but never greater? Is it possible to have variables that show greater absolute Spearman than absolute Pearson?



    Example:



    # Spearman == Pearson
    # We're correlating ranked variables from the beginning
    foo <- 1:1e3
    bar <- 1:1e3
    sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))

    # Spearman < Pearson
    foo <- rnorm(1e3)
    bar <- rnorm(1e3)
    sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))









    share|cite|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      If Spearman correlation is Pearson correlation, but on ranks of the data - does it mean that absolute Spearman will always be lower or equal to absolute Pearson correlation, but never greater? Is it possible to have variables that show greater absolute Spearman than absolute Pearson?



      Example:



      # Spearman == Pearson
      # We're correlating ranked variables from the beginning
      foo <- 1:1e3
      bar <- 1:1e3
      sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))

      # Spearman < Pearson
      foo <- rnorm(1e3)
      bar <- rnorm(1e3)
      sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))









      share|cite|improve this question













      If Spearman correlation is Pearson correlation, but on ranks of the data - does it mean that absolute Spearman will always be lower or equal to absolute Pearson correlation, but never greater? Is it possible to have variables that show greater absolute Spearman than absolute Pearson?



      Example:



      # Spearman == Pearson
      # We're correlating ranked variables from the beginning
      foo <- 1:1e3
      bar <- 1:1e3
      sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))

      # Spearman < Pearson
      foo <- rnorm(1e3)
      bar <- rnorm(1e3)
      sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))






      correlation pearson-r spearman-rho






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked 2 days ago









      PoGibas

      6118




      6118




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          10
          down vote



          accepted










          Simple example in which Spearman correlation is greater than Pearson correlation:



          x = 1:10; y = x^2
          cor(x,y, meth = "p")
          [1] 0.9745586
          cor(x,y, meth = "s")
          [1] 1





          share|cite|improve this answer




















          • You're saying - non linear will give greater correlation in Spearman?
            – PoGibas
            yesterday






          • 3




            Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
            – BruceET
            yesterday

















          up vote
          2
          down vote













          Using your own example we can see there is no particular bias for two independent normal distributions:



          library(tidyverse)
          d <- data_frame(
          x = replicate(1e4, rnorm(1e3), FALSE),
          y = replicate(1e4, rnorm(1e3), FALSE),
          pearson = map2_dbl(x, y, cor, method = 'pearson'),
          spearman = map2_dbl(x, y, cor, method = 'spearman'),
          p_min_s = pearson - spearman
          )

          qplot(d$p_min_s, xlab = c('pearson - spearman'))


          enter image description here






          share|cite|improve this answer



























            up vote
            1
            down vote













            Several Pearson & Spearman correlation values are compared here.






            share|cite|improve this answer








            New contributor




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








            We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.













            • This link may perish at some point, which would make this answer less than useful.
              – Axeman
              yesterday










            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f366326%2fis-spearman-correlation-never-greater-than-pearson-correlation%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            10
            down vote



            accepted










            Simple example in which Spearman correlation is greater than Pearson correlation:



            x = 1:10; y = x^2
            cor(x,y, meth = "p")
            [1] 0.9745586
            cor(x,y, meth = "s")
            [1] 1





            share|cite|improve this answer




















            • You're saying - non linear will give greater correlation in Spearman?
              – PoGibas
              yesterday






            • 3




              Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
              – BruceET
              yesterday














            up vote
            10
            down vote



            accepted










            Simple example in which Spearman correlation is greater than Pearson correlation:



            x = 1:10; y = x^2
            cor(x,y, meth = "p")
            [1] 0.9745586
            cor(x,y, meth = "s")
            [1] 1





            share|cite|improve this answer




















            • You're saying - non linear will give greater correlation in Spearman?
              – PoGibas
              yesterday






            • 3




              Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
              – BruceET
              yesterday












            up vote
            10
            down vote



            accepted







            up vote
            10
            down vote



            accepted






            Simple example in which Spearman correlation is greater than Pearson correlation:



            x = 1:10; y = x^2
            cor(x,y, meth = "p")
            [1] 0.9745586
            cor(x,y, meth = "s")
            [1] 1





            share|cite|improve this answer












            Simple example in which Spearman correlation is greater than Pearson correlation:



            x = 1:10; y = x^2
            cor(x,y, meth = "p")
            [1] 0.9745586
            cor(x,y, meth = "s")
            [1] 1






            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered yesterday









            BruceET

            2,940418




            2,940418











            • You're saying - non linear will give greater correlation in Spearman?
              – PoGibas
              yesterday






            • 3




              Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
              – BruceET
              yesterday
















            • You're saying - non linear will give greater correlation in Spearman?
              – PoGibas
              yesterday






            • 3




              Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
              – BruceET
              yesterday















            You're saying - non linear will give greater correlation in Spearman?
            – PoGibas
            yesterday




            You're saying - non linear will give greater correlation in Spearman?
            – PoGibas
            yesterday




            3




            3




            Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
            – BruceET
            yesterday




            Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders).
            – BruceET
            yesterday












            up vote
            2
            down vote













            Using your own example we can see there is no particular bias for two independent normal distributions:



            library(tidyverse)
            d <- data_frame(
            x = replicate(1e4, rnorm(1e3), FALSE),
            y = replicate(1e4, rnorm(1e3), FALSE),
            pearson = map2_dbl(x, y, cor, method = 'pearson'),
            spearman = map2_dbl(x, y, cor, method = 'spearman'),
            p_min_s = pearson - spearman
            )

            qplot(d$p_min_s, xlab = c('pearson - spearman'))


            enter image description here






            share|cite|improve this answer
























              up vote
              2
              down vote













              Using your own example we can see there is no particular bias for two independent normal distributions:



              library(tidyverse)
              d <- data_frame(
              x = replicate(1e4, rnorm(1e3), FALSE),
              y = replicate(1e4, rnorm(1e3), FALSE),
              pearson = map2_dbl(x, y, cor, method = 'pearson'),
              spearman = map2_dbl(x, y, cor, method = 'spearman'),
              p_min_s = pearson - spearman
              )

              qplot(d$p_min_s, xlab = c('pearson - spearman'))


              enter image description here






              share|cite|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                Using your own example we can see there is no particular bias for two independent normal distributions:



                library(tidyverse)
                d <- data_frame(
                x = replicate(1e4, rnorm(1e3), FALSE),
                y = replicate(1e4, rnorm(1e3), FALSE),
                pearson = map2_dbl(x, y, cor, method = 'pearson'),
                spearman = map2_dbl(x, y, cor, method = 'spearman'),
                p_min_s = pearson - spearman
                )

                qplot(d$p_min_s, xlab = c('pearson - spearman'))


                enter image description here






                share|cite|improve this answer












                Using your own example we can see there is no particular bias for two independent normal distributions:



                library(tidyverse)
                d <- data_frame(
                x = replicate(1e4, rnorm(1e3), FALSE),
                y = replicate(1e4, rnorm(1e3), FALSE),
                pearson = map2_dbl(x, y, cor, method = 'pearson'),
                spearman = map2_dbl(x, y, cor, method = 'spearman'),
                p_min_s = pearson - spearman
                )

                qplot(d$p_min_s, xlab = c('pearson - spearman'))


                enter image description here







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered yesterday









                Axeman

                1659




                1659




















                    up vote
                    1
                    down vote













                    Several Pearson & Spearman correlation values are compared here.






                    share|cite|improve this answer








                    New contributor




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








                    We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.













                    • This link may perish at some point, which would make this answer less than useful.
                      – Axeman
                      yesterday














                    up vote
                    1
                    down vote













                    Several Pearson & Spearman correlation values are compared here.






                    share|cite|improve this answer








                    New contributor




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








                    We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.













                    • This link may perish at some point, which would make this answer less than useful.
                      – Axeman
                      yesterday












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    Several Pearson & Spearman correlation values are compared here.






                    share|cite|improve this answer








                    New contributor




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









                    Several Pearson & Spearman correlation values are compared here.







                    share|cite|improve this answer








                    New contributor




                    gunes 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 answer



                    share|cite|improve this answer






                    New contributor




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









                    answered yesterday









                    gunes

                    3285




                    3285




                    New contributor




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





                    New contributor





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






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



                    We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.




                    We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.












                    • This link may perish at some point, which would make this answer less than useful.
                      – Axeman
                      yesterday
















                    • This link may perish at some point, which would make this answer less than useful.
                      – Axeman
                      yesterday















                    This link may perish at some point, which would make this answer less than useful.
                    – Axeman
                    yesterday




                    This link may perish at some point, which would make this answer less than useful.
                    – Axeman
                    yesterday

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f366326%2fis-spearman-correlation-never-greater-than-pearson-correlation%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    Installing NextGIS Connect into QGIS 3?

                    One-line joke