Korélasi
- Artikel ieu ngeunaan koefisien korelasi antara dua variable acak. Watesan korelasi bisa ogé hartina korelasi silang dua fungsi.
![](http://178.128.105.246/content-http-upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Corr-example.png/220px-Corr-example.png)
Dina tiori probabiliti jeung statistik, korelasi, disebut ogé koefisien korelasi, nyaéta ukuran numerik ngeunaan kuatna hubungan linier antara dua variabel acak. Dina pamakéan statistik nu ilahar, korelas atawa ko-relasi nujul kana pakaitna dua variabel bebéas. Dina hal nu leuwih lega, aya sababaraha koefisien, ukuran tingkat pakait nu dicokot tina data alam atawa data asli.
gedéna béda korelasi dipaké keur kaayaan nu béda. Nu panghadéna nyaéta korefisien korelasi produk-momen Pearson, nu ditangtukeun ku cara ngabagi kovarian dua variabel ku hasil kali simpangan bakuna. Korelasi mimiti diwanohkeun ku Francis Galton.
Koefisien produk-momen Pearson
[édit | édit sumber]Pasipatan Matematika
[édit | édit sumber]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 ogé dituliskeun jadi:
Korélasi bisa dihartikeun lamun simpangan baku kawengku tur salah sahijina lain enol. Rumusan itu dina kateusaruaan Cauchy-Schwarz yén 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 di antarana keur sakabéh pasualan, nunjukkeun tingkat sakumaha gumantungna variabel sacara linier. Koefisien nu pangdeukeutna boh kana −1 atawa 1, mibanda harti beuki kuat korelasi antara dua variabel eta.
Lamun variabel mandiri mangka korelasina bakal 0, tapi teu salawasna bener sabab koefisien korelasi ngan keur néangan kabébasan linier antara dua variabel. Contona: Anggap variabel acak X mangrupa sebaran seragam dina interval ti −1 ka 1, sarta Y = X2. Mangka Y satemenna ditangtukeun ku X, sabab kitu X tur Y bisa waé asalna tina dua variabel acak mandiri, tapi korelasi nol; maranéhna taya korelasi. Sanajan kitu, dina kasus basa X tur Y ngahiji normal, mandiri sarua jeung taya korelasi.
Korelasi sampel
[édit | édit sumber]Lamun hiji runtuyan n tina hasil ngukur X tur Y dituliskeun salaku xi tur yi nu mana i = 1, 2, ..., n, mangka koefisien korelasi produk-momen Pearson bisa dipaké keur ngiker korelasi X jeung Y . Koefisien Péarson disebut ogé "koefisien korelasi sampel". Hal ieu husus lamun X tur Y duanana kasebar normal. Koefisien korelasi Péarson jadi estimasi nu hadé keur korelasi X jeung Y . Koefisien korelasi Péarson ditulis:
nu mana jeung nyaéta rata-rata tina xi jeung yi , sx jeung sy nyaéta 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, gedéna nilai mutlak sampel korelasi kudu kurang atawa sarua jeung 1. ngagunakeun rumus di luhur mangrupa hal nu ilahar dipaké dina algoritma tunggal keur ngitung korelasi sampel, hal ieu teu stabil dina itungan sacara numerik (tempo di handap keur nu leuwih jéntré).
Kuadrat koefisien korelasi sampel, disebut ogé koefisien determinasi, nyaéta bagéan tina varian dina yi nu diitung ku cara fit linier xi ka yi . Ditulis
nu mana sy|x2 nyaéta kuadrat kasalahan régrési liniér xi dina yi ku sasaruan y = a + bx:
jeung sy2 nyaéta 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 méré ide keur dimensi nu leuwih luhur. Saperti nu dijelaskeun di luhur korélasi koéfsien sampel nyaéta bagéan 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 linéar 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 nyaéta
Sebaran koefisien korelasi geus diterangkeun ku R. A. Fisher[1][2] jeung A. K. Gayen.[3]
![]() |
Artikel ieu keur dikeureuyeuh, ditarjamahkeun tina basa Inggris. Bantuanna didagoan pikeun narjamahkeun. |
Interpretasi korélasi sacara geometri
[édit | édit sumber]Koéfisién korélasi bisa ogé 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 méan so as to have an average of zero. Some practitioners prefer an uncentered (non-Péarson-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 Péarson 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.
Interpretation of the size of a correlation
[édit | édit sumber]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 reséarch, 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 gréater contribution from complicating factors.
Non-parametric correlation coefficients
[édit | édit sumber]Péarson'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.
Other measures of dependence among random variables
[édit | édit sumber]To get a méasure for more general dependencies in the data (also nonlinéar) 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 théorised latent variables.
Copulas and correlation
[édit | édit sumber]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).
Correlation matrices
[édit | édit sumber]The correlation matrix of n random variables X1, ..., Xn is the n × n matrix whose i,j entry is corr(Xi, Xj). If the méasures 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 .
Removing correlation
[édit | édit sumber]It is always possible to remove the correlation between zero-méan random variables with a linéar transform, even if the relationship between the variables is nonlinéar. 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 méan, and T is the data transformed so all variables have zero méan, 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:
Common misconceptions about correlation
[édit | édit sumber]Correlation and causality
[édit | édit sumber]The conventional dictum that "correlation does not imply causation" méans that correlation cannot be validly used to infer a causal relationship between the variables. This dictum should not be taken to méan 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 wéather may cause both crime and ice-créam purchases. Therefore crime is correlated with ice-créam purchases. But crime does not cause ice-créam purchases and ice-créam purchases do not cause crime.
A correlation between age and height in children is fairly causally transparent, but a correlation between mood and héalth in péople is less so. Does improved mood léad to improved héalth? Or does good héalth léad 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.
Correlation and linearity
[édit | édit sumber]![](http://178.128.105.246/content-http-upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Anscombe.svg/325px-Anscombe.svg.png)
While Péarson correlation indicates the strength of a linéar 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 créated by Francis Anscombe.[5] The four variables have the same méan (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 linéar, and the Péarson correlation coefficient is not relevant. In the third case (bottom left), the linéar 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 linéar.
These examples indicate that the correlation coefficient, as a summary statistic, cannot replace the individual examination of the data.
Computing correlation accurately in a single pass
[édit | édit sumber]The following algorithm (in pseudocode) will estimate correlation with good numerical stability
sum_sq_x = 0 sum_sq_y = 0 sum_coproduct = 0 méan_x = x[1] méan_y = y[1] for i in 2 to N: sweep = (i - 1.0) / i delta_x = x[i] - méan_x delta_y = y[i] - méan_y sum_sq_x += delta_x * delta_x * sweep sum_sq_y += delta_y * delta_y * sweep sum_coproduct += delta_x * delta_y * sweep méan_x += delta_x / i méan_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.
See also
[édit | édit sumber]Notes and references
[édit | édit sumber]- ↑ 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.
Bacaan saterusna
[édit | édit sumber]- 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.
Tumbu kaluar
[édit | édit sumber]- Understanding Correlation Archived 2007-12-17 di Wayback Machine - Introductory material by a U. of Hawaii Prof.
- Statsoft Electronic Textbook Archived 2009-02-27 di Wayback Machine
- 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.