Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8920783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:21:55+00:00 2026-06-15T06:21:55+00:00

from the sciPy library I used: scipy.stats.stats import pearsonr to calculate the correlation coefficient

  • 0

from the sciPy library I used: scipy.stats.stats import pearsonr to calculate the correlation coefficient for two arrays and I got a value of: (0.80751532276005755, 0.19248467723994242).

I thought that I would have just got one value within the range -1 to +1, so I’m unsure how to interpret these two results. These are my two arrays:

x = [50,500,1500,2500]
y = [17, 6, 6, 194]

and I did:

pearsonr(x,y)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:21:56+00:00Added an answer on June 15, 2026 at 6:21 am

    pearsonr() returns a two-tuple consisting of the correlation coefficient and the corresponding p-value:

    • The correlation coefficient can range from -1 to +1.
    • The null hypothesis is that the two variables are uncorrelated. The p-value is a number between zero and one that represents the probability that your data would have arisen if the null hypothesis were true.

    For a further discussion, see http://www.eecs.qmul.ac.uk/~norman/blog_articles/p_values.pdf

    I thought that I would have just got one value within the range -1 to +1

    If you just need to the correlation coefficient, simply ignore the second element of the tuple (the p-value):

    corrxy = pearsonr(x,y)[0]
    

    It might be worth mentioning that there’s also numpy.corrcoef(), which computes the correlation matrix (without p-values).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

>>> from scipy.special import erf >>> print (erf(0.j)) __main__:1: RuntimeWarning: invalid value encountered in
What's wrong with this snippet of code? import numpy as np from scipy import
I have a lognorm distribution from scipy and its parameters are known. import scipy
I'm trying to use the ndimage library from scipy, but its apparently missing. I
Scipy version 0.10.0 Consider the following: >>> import math >>> from scipy.optimize import fsolve
With this code: import scipy from scipy import * x = r_[1:15] print x
This program: from __future__ import division import numpy as np from scipy.optimize import minimize
I'm trying to copy the Scipy Cookbook function: from scipy import ogrid, sin, mgrid,
Is there a way to dynamically expand an scipy array from scipy import sci
I have the following python MWE (code is explained below) #!/usr/bin/python from scipy import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.