Korélasi
-
- Artikel ieu ngeunaan koefisien korelasi antara dua variable acak. Watesan korelasi bisa oge hartina korelasi silang dua fungsi.
Dina tiori probabiliti jeung statistik, korelasi, disebut oge koefisien korelasi, nyaeta ukuran numerik ngeunaan kuatna hubungan linier antara dua variabel acak. Dina pamakean statistik nu ilahar, korelas atawa ko-relasi nujul kana pakaitna dua variabel bebeas. Dina hal nu leuwih lega, aya sababaraha koefisien, ukuran tingkat pakait nu dicokot tina data alam atawa data asli.
Gedena beda korelasi dipake keur kaayaan nu beda. Nu panghadena nyaeta korefisien korelasi produk-momen Pearson, nu ditangtukeun ku cara ngabagi kovarian dua variabel ku hasil kali simpangan bakuna. Korelasi mimiti diwanohkeun ku Francis Galton.
[édit] Koefisien produk-momen Pearson
[édit] Pasipatan Matematika
Korelasi ρxy antara dua variabel acak X and Y jeung nilai ekspektasi μX jeung μY sarta simpangan baku σX jeung σY dihartikeun:
Anggap μX=E(X), σX2=E(X2)-E2(X) tur saperti keur Y, bisa oge dituliskeun jadi:
Korélasi bisa dihartikeun lamun simpangan baku kawengku tur salah sahijina lain enol. Rumusan itu dina kateusaruaan Cauchy-Schwarz yen korelasi teu bisa leuwih ti 1 dina nilai mutlakna.
Korelasi sarua jeung 1 lamun mibanda hubungan naek sacara liner, −1 lamun mibanda hubungan turun linier, tur sababaraha nilai diantarana keur sakabeh pasualan, nunjukeun tingkat sakumaha gumantungna variabel sacara linier. Koefisien nu pangdeukeutna boh kana −1 atawa 1, ngabogaan harti beuki kuat korelasi antara dua variabel eta.
Lamun variabel mandiri mangka korelasina bakal 0, tapi teu salawasna bener sabab koefisien korelasi ngan keur neangan kabebasan linier antara dua variabel. Contona: Anggap variabel acak X ngarupakeun sebaran seragam dina interval ti −1 ka 1, sarta Y = X2. Mangka Y satemenna ditangtukeun ku X, sabab kitu X tur Y bisa wae asalna tina dua variabel acak mandiri, tapi korelasi nol; maranehna taya korelasi. Sanajan kitu, dina kasus basa X tur Y ngahiji normal, mandiri sarua jeung taya korelasi.
[édit] Korelasi sampel
Lamun hiji runtuyan n tina hasil ngukur X tur Y dituliskeun salaku xi tur yi numana i = 1, 2, ..., n, mangka koefisien korelasi produk-momen Pearson bisa dipake keur ngiker korelasi X jeung Y . Koefisien Pearson disebut oge "koefisien korelasi sampel". Hal ieu husus lamun X tur Y duanana kasebar normal. Koefisien korelasi Pearson jadi estimasi nu hade keur korelasi X jeung Y . Koefisien korelasi Pearson ditulis:
numana
jeung
nyaeta rata-rata tina xi jeung yi , sx jeung sy nyaeta simpangan baku tina xi jeung yi sarta jumlahna ti i = 1 nepi ka n. Saperti dina korelasi populasi, bisa ditulis salaku
Sakali deui, ieu bener dina korelasi populasi, gedena nilai mutlak sampel korelasi kudu kurang atawa sarua jeung 1. Migunakeun rumus di luhur ngarupakeun hal nu ilahar dipake dina algoritma tunggal keur ngitung korelasi sampel, hal ieu teu stabil dina itungan sacara numerik (tempo di handap keur nu leuwih jentre).
Kuadrat koefisien korelasi sampel, disebut oge koefisien determinasi, nyaeta bagean tina varian dina yi nu diitung ku cara fit linier xi ka yi . Ditulis
numana sy|x2 nyaeta kuadrat kasalahan régrési liniér xi dina yi ku sasaruan y = a + bx:
jeung sy2 nyaeta ngan varian y:
Catetan, lamun koéfisien sampel korélasi simetri dina xi jeung yi , bakal meunang niley nu sarua keur fit yi ka xi :
Ieu sasaruan mere ide keur dimensi nu leuwih luhur. Saperti nu dijelaskeun di luhur korélasi koéfsien sampel nyaeta bagean tian itungan varian ku cara nga-fit-keun linear submanifold 1-dimensi kana runtuyan vektor (xi , yi ) 2 dimensi, mangka bisa dihartikeun koefisien korelasi keur fit dina m-dimensi linear submanifold kana runtuyan vektor n-dimensi. Contona, lamun nga-fit-keun widang z = a + bx + cy kana runtuyan data (xi , yi , zi ) mangka koefisien korelasi z ka x jeung y nyaeta
Sebaran koefisien korelasi geus diterangkeun ku R. A. Fisher[1][2] jeung A. K. Gayen.[3]
| Artikel ieu keur dikeureuyeuh, ditarjamahkeun tina basa Inggris. Bantosanna diantos kanggo narjamahkeun. |
[édit] Interpretasi korélasi sacara geometri
Koéfisién korélasi bisa oge ditempo salaku kosinus sudut antara dua vektor sampel nu dicokot tina dua variabel acak.
Caution: This method only works with centered data, i.e., data which have been shifted by the sample mean so as to have an average of zero. Some practitioners prefer an uncentered (non-Pearson-compliant) correlation coefficient. See the example below for a comparison.
As an example, suppose five countries are found to have gross national products of 1, 2, 3, 5, and 8 billion dollars, respectively. Suppose these same five countries (in the same order) are found to have 11%, 12%, 13%, 15%, and 18% poverty. Then let x and y be ordered 5-element vectors containing the above data: x = (1, 2, 3, 5, 8) and y = (0.11, 0.12, 0.13, 0.15, 0.18).
By the usual procedure for finding the angle between two vectors (see dot product), the uncentered correlation coefficient is:
Note that the above data were deliberately chosen to be perfectly correlated: y = 0.10 + 0.01 x. The Pearson correlation coefficient must therefore be exactly one. Centering the data (shifting x by E(x) = 3.8 and y by E(y) = 0.138) yields x = (-2.8, -1.8, -0.8, 1.2, 4.2) and y = (-0.028, -0.018, -0.008, 0.012, 0.042), from which
as expected.
[édit] Interpretation of the size of a correlation
| Correlation | Negative | Positive |
|---|---|---|
| Small | −0.29 to −0.10 | 0.10 to 0.29 |
| Medium | −0.49 to −0.30 | 0.30 to 0.49 |
| Large | −1.00 to −0.50 | 0.50 to 1.00 |
Several authors have offered guidelines for the interpretation of a correlation coefficient. Cohen (1988),[4] for example, has suggested the following interpretations for correlations in psychological research, in the table on the right.
As Cohen himself has observed, however, all such criteria are in some ways arbitrary and should not be observed too strictly. This is because the interpretation of a correlation coefficient depends on the context and purposes. A correlation of 0.9 may be very low if one is verifying a physical law using high-quality instruments, but may be regarded as very high in the social sciences where there may be a greater contribution from complicating factors.
[édit] Non-parametric correlation coefficients
Pearson's correlation coefficient is a parametric statistic and when distributions are not normal it may be less useful than non-parametric correlation methods, such as Chi-square, Point biserial correlation, Spearman's ρ and Kendall's τ. They are a little less powerful than parametric methods if the assumptions underlying the latter are met, but are less likely to give distorted results when the assumptions fail.
[édit] Other measures of dependence among random variables
To get a measure for more general dependencies in the data (also nonlinear) it is better to use the correlation ratio which is able to detect almost any functional dependency, or mutual information/total correlation which is capable of detecting even more general dependencies.
The polychoric correlation is another correlation applied to ordinal data that aims to estimate the correlation between theorised latent variables.
[édit] Copulas and correlation
The information given by a correlation coefficient is not enough to define the dependence structure between random variables; to fully capture it we must consider a copula between them. The correlation coefficient completely defines the dependence structure only in very particular cases, for example when the cumulative distribution functions are the multivariate normal distributions. In the case of elliptic distributions it characterizes the (hyper-)ellipses of equal density, however, it does not completely characterize the dependence structure (for example, the a multivariate t-distribution's degrees of freedom determine the level of tail dependence).
[édit] Correlation matrices
The correlation matrix of n random variables X1, ..., Xn is the n × n matrix whose i,j entry is corr(Xi, Xj). If the measures of correlation used are product-moment coefficients, the correlation matrix is the same as the covariance matrix of the standardized random variables Xi /SD(Xi) for i = 1, ..., n. Consequently it is necessarily a positive-semidefinite matrix.
The correlation matrix is symmetric because the correlation between
and
is the same as the correlation between
and
.
[édit] Removing correlation
It is always possible to remove the correlation between zero-mean random variables with a linear transform, even if the relationship between the variables is nonlinear. Suppose a vector of n random variables is sampled m times. Let X be a matrix where
is the jth variable of sample i. Let
be an r by c matrix with every element 1. Then D is the data transformed so every random variable has zero mean, and T is the data transformed so all variables have zero mean, unit variance, and zero correlation with all other variables.
where an exponent of -1/2 represents the matrix square root of the inverse of a matrix. The covariance matrix of T will be the identity matrix. If a new data sample x is a row vector of n elements, then the same transform can be applied to x to get the transformed vectors d and t:
[édit] Common misconceptions about correlation
[édit] Correlation and causality
The conventional dictum that "correlation does not imply causation" means that correlation cannot be validly used to infer a causal relationship between the variables. This dictum should not be taken to mean that correlations cannot indicate causal relations. However, the causes underlying the correlation, if any, may be indirect and unknown. Consequently, establishing a correlation between two variables is not a sufficient condition to establish a causal relationship (in either direction).
Here is a simple example: hot weather may cause both crime and ice-cream purchases. Therefore crime is correlated with ice-cream purchases. But crime does not cause ice-cream purchases and ice-cream purchases do not cause crime.
A correlation between age and height in children is fairly causally transparent, but a correlation between mood and health in people is less so. Does improved mood lead to improved health? Or does good health lead to good mood? Or does some other factor underlie both? Or is it pure coincidence? In other words, a correlation can be taken as evidence for a possible causal relationship, but cannot indicate what the causal relationship, if any, might be.
[édit] Correlation and linearity
While Pearson correlation indicates the strength of a linear relationship between two variables, its value alone may not be sufficient to evaluate this relationship, especially in the case where the assumption of normality is incorrect.
The image on the right shows scatterplots of Anscombe's quartet, a set of four different pairs of variables created by Francis Anscombe.[5] The four
variables have the same mean (7.5), standard deviation (4.12), correlation (0.81) and regression line (
). However, as can be seen on the plots, the distribution of the variables is very different. The first one (top left) seems to be distributed normally, and corresponds to what one would expect when considering two variables correlated and following the assumption of normality. The second one (top right) is not distributed normally; while an obvious relationship between the two variables can be observed, it is not linear, and the Pearson correlation coefficient is not relevant. In the third case (bottom left), the linear relationship is perfect, except for one outlier which exerts enough influence to lower the correlation coefficient from 1 to 0.81. Finally, the fourth example (bottom right) shows another example when one outlier is enough to produce a high correlation coefficient, even though the relationship between the two variables is not linear.
These examples indicate that the correlation coefficient, as a summary statistic, cannot replace the individual examination of the data.
[édit] Computing correlation accurately in a single pass
The following algorithm (in pseudocode) will estimate correlation with good numerical stability
sum_sq_x = 0
sum_sq_y = 0
sum_coproduct = 0
mean_x = x[1]
mean_y = y[1]
for i in 2 to N:
sweep = (i - 1.0) / i
delta_x = x[i] - mean_x
delta_y = y[i] - mean_y
sum_sq_x += delta_x * delta_x * sweep
sum_sq_y += delta_y * delta_y * sweep
sum_coproduct += delta_x * delta_y * sweep
mean_x += delta_x / i
mean_y += delta_y / i
pop_sd_x = sqrt( sum_sq_x / N )
pop_sd_y = sqrt( sum_sq_y / N )
cov_x_y = sum_coproduct / N
correlation = cov_x_y / (pop_sd_x * pop_sd_y)
For an enlightening experiment, check the correlation of {900,000,000 + i for i=1...100} with {900,000,000 - i for i=1...100}, perhaps with a few values modified. Poor algorithms will fail.
[édit] See also
[édit] Notes and references
- ↑ R. A. Fisher (1915). "Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population". Biometrika 10: 507–521.
- ↑ R. A. Fisher (1921). "On the probable error of a coefficient of correlation deduced from a small sample". Metron.
- ↑ A. K. Gayen (1951). "The frequency distribution of the product moment correlation coefficent in random samples of any size draw from non-normal universes". Biometrika 38: 219–247.
- ↑ Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.) Hillsdale, NJ: Lawrence Erlbaum Associates. ISBN 0-8058-0283-5.
- ↑ Anscombe, Francis J. (1973) Graphs in statistical analysis. American Statistician, 27, 17–21.
[édit] Bacaan saterusna
- Cohen, J., Cohen P., West, S.G., & Aiken, L.S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences. (3rd ed.) Hillsdale, NJ: Lawrence Erlbaum Associates.
[édit] Tumbu kaluar
- Understanding Correlation - Introductory material by a U. of Hawaii Prof.
- Statsoft Electronic Textbook
- Pearson's Correlation Coefficient - How to calculate it quickly
- Learning by Simulations - The distribution of the correlation coefficient
- Correlation measures the strength of a linear relationship between two variables.














