Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pearson correlation coefficient
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===For a sample=== Pearson's correlation coefficient, when applied to a [[sample (statistics)|sample]], is commonly represented by <math>r_{xy}</math> and may be referred to as the ''sample correlation coefficient'' or the ''sample Pearson correlation coefficient''. We can obtain a formula for <math>r_{xy}</math> by substituting estimates of the covariances and variances based on a sample into the formula above. Given paired data <math>\left\{ (x_1,y_1),\ldots,(x_n,y_n) \right\}</math> consisting of <math>n</math> pairs, <math>r_{xy}</math> is defined as <math display=block>r_{xy} =\frac{\sum ^n _{i=1}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum ^n _{i=1}(x_i - \bar{x})^2} \sqrt{\sum ^n _{i=1}(y_i - \bar{y})^2}}</math> where *<math>n</math> is sample size *<math>x_i, y_i</math> are the individual sample points indexed with ''i'' *<math display="inline">\bar{x} = \frac{1}{n} \sum_{i=1}^n x_i</math> (the sample mean); and analogously for <math>\bar{y}</math>. Rearranging gives us this<ref name="RealCorBasic"/> formula for <math>r_{xy}</math>: :<math>r_{xy} = \frac{\sum_i x_i y_i-n\bar{x}\bar{y}} {\sqrt{\sum_i x_i^2-n\bar{x}^2}~\sqrt{\sum_i y_i^2-n\bar{y}^2}},</math> where <math>n, x_i, y_i, \bar{x}, \bar{y}</math> are defined as above. Rearranging again gives us this formula for <math>r_{xy}</math>: :<math>r_{xy} = \frac{n\sum x_i y_i - \sum x_i\sum y_i} {\sqrt{n\sum x_i^2-\left(\sum x_i\right)^2}~\sqrt{n\sum y_i^2-\left(\sum y_i\right)^2}},</math> where <math>n, x_i, y_i</math> are defined as above. This formula suggests a convenient single-pass algorithm for calculating sample correlations, though depending on the numbers involved, it can sometimes be [[numerical stability|numerically unstable]]. An equivalent expression gives the formula for <math>r_{xy}</math> as the mean of the products of the [[standard score]]s as follows: :<math>r_{xy} = \frac{1}{n-1} \sum ^n _{i=1} \left( \frac{x_i - \bar{x}}{s_x} \right) \left( \frac{y_i - \bar{y}}{s_y} \right)</math> where *<math>n, x_i, y_i, \bar{x}, \bar{y}</math> are defined as above, and <math>s_x, s_y</math> are defined below *<math display="inline">\left( \frac{x_i - \bar{x}}{s_x} \right)</math> is the standard score (and analogously for the standard score of <math>y</math>). Alternative formulae for <math>r_{xy}</math> are also available. For example, one can use the following formula for <math>r_{xy}</math>: :<math>r_{xy} =\frac{\sum x_iy_i-n \bar{x} \bar{y}}{(n-1) s_x s_y}</math> where *<math>n, x_i, y_i, \bar{x}, \bar{y}</math> are defined as above and: *<math display="inline">s_x = \sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar{x})^2}</math> (the [[sample standard deviation]]); and analogously for <math>s_y</math>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)