Pasek boczny

en:statpqpl:korelpl

Correlation

\begin{pspicture}(0,6)(15,14.5)
\rput(2,14){\hyperlink{interwalowa}{Interval scale}}
\rput[tl](.1,13.4){\ovalnode{A}{\hyperlink{rozklad_normalny}{\begin{tabular}{c}Are\\the data\\normally\\distributed?\end{tabular}}}}
\rput[br](2.9,6.2){\rnode{B}{\psframebox{\hyperlink{wspolczynnik_pearsona}{\begin{tabular}{c}tests for\\linear\\correlation\\coefficient $r_p$\\ and linear \\regression\\coefficient $\beta$\end{tabular}}}}}
\ncline[angleA=-90, angleB=90, arm=.5, linearc=.2]{->}{A}{B}

\rput(2.2,10.4){Y}
\rput(4.3,12.5){N}

\rput(7.5,14){\hyperlink{porzadkowa}{Ordinal scale}}
\rput[br](9.2,11.09){\rnode{C}{\psframebox{\hyperlink{wspolczynniki_monotoniczne}{\begin{tabular}{c}tests for\\monotonic\\correlation\\coefficients\\$r_s$ or $\tau$ \end{tabular}}}}}
\ncline[angleA=-90, angleB=90, arm=.5, linearc=.2]{->}{A}{C}

\rput(12.5,14){\hyperlink{nominalna}{Nominal scale}}
\rput[br](16.1,11.9){\rnode{D}{\psframebox{\hyperlink{wsp_tabel_kontyngencji}{\begin{tabular}{c}$\chi^2$ test and dedicated to them\\$C$, $\phi$, $V$ contingency coefficients\\or test for $Q$ contingency coefficient\end{tabular}}}}}

\rput(4,9.8){\hyperlink{testy_normalnosci}{normality tests}}
\psline[linestyle=dotted]{<-}(3.4,11.2)(4,10)
\end{pspicture}

The Correlation coefficients are one of the measures of descriptive statistics which represent the level of correlation (dependence) between 2 or more features (variables). The choice of a particular coefficient depends mainly on the scale, on which the measurements were done. Calculation of coefficients is one of the first steps of the correlation analysis. Then the statistic significance of the gained coefficients may be checked using adequate tests.

Note

Note, that the dependence between variables does not always show the cause-and-effect relationship.

 

Parametric tests

The linear correlation coefficients

The Pearson product-moment correlation coefficient $r_p$ called also the Pearson's linear correlation coefficient (Pearson (1896,1900)) is used to decribe the strength of linear relations between 2 features. It may be calculated on an interval scale as long as there are no measurement outliers and the distribution of residuals or the distribution of the analyed features is a normal one.

\begin{displaymath}
r_p=\frac{\sum_{i=1}^n(x_i-\overline{x})(y_i-\overline{y})}{\sqrt{\sum_{i=1}^n(x_i-\overline{x})^2}\sqrt{\sum_{i=1}^n(y_i-\overline{y})^2}},
\end{displaymath}

where:

$x_i, y_i$ - the following values of the feature $X$ and $Y$,

$\overline{x}, \overline{y}$ - means values of features: $X$ and $Y$,

$n$ - sample size.

Note

$R_p$ – the Pearson product-moment correlation coefficient in a population;

$r_p$ – the Pearson product-moment correlation coefficient in a sample.

The value of $r_p\in<-1; 1>$, and it should be interpreted the following way:

  • $r_p\approx1$ means a strong positive linear correlation – measurement points are closed to a straight line and when the independent variable increases, the dependent variable increases too;
  • $r_p\approx-1$ means a strong negative linear correlation – measurement points are closed to a straight line, but when the independent variable increases, the dependent variable decreases;
  • if the correlation coefficient is equal to the value or very closed to zero, there is no linear dependence between the analysed features (but there might exist another relation - a not linear one).

Graphic interpretation of $r_p$.

\begin{pspicture}(0,-.8)(12.5,2.5)

\psline{->}(.5,0)(.5,2)
\psline{->}(.5,0)(2.5,0)
\rput(.8,1){*}
\rput(1.7,.9){*}
\rput(1,.7){*}
\rput(1.3,1.6){*}
\rput(1.5,1){*}
\rput(1.1,.4){*}
\rput(2.1,1){*}
\rput(1.9,1.8){*}
\rput(.2,2){$y$}
\rput(2.5,-.2){$x$}
\rput(1.5,-.7){$r_p\approx0$}


\psline{->}(4.5,0)(4.5,2)
\psline{->}(4.5,0)(6.5,0)
\psline{-}(4.7,.5)(6.3,1.8)
\rput(4.8,.7){*}
\rput(5.3,1){*}
\rput(5,.4){*}
\rput(6,1.7){*}
\rput(5.7,1.2){*}
\rput(4.2,2){$y$}
\rput(6.5,-.2){$x$}
\rput(5.5,-.7){$r_p\approx1$}

\psline{->}(8.5,0)(8.5,2)
\psline{->}(8.5,0)(10.5,0)
\psline{-}(8.7,1.8)(10.3,.2)
\rput(9.6,.9){*}
\rput(8.9,1.4){*}
\rput(9.7,1.2){*}
\rput(10.1,.2){*}
\rput(9.9,.4){*}
\rput(8.2,2){$y$}
\rput(10.5,-.2){$x$}
\rput(9.5,-.7){$r_p\approx-1$}
\end{pspicture}

If one out of the 2 analysed features is constant (it does not matter if the other feature is changed), the features are not dependent from each other. In that situation $r_p$ can not be calculated.

Note

You are not allowed to calculate the correlation coefficient if: there are outliers in a sample (they may make that the value and the sign of the coefficient would be completely wrong), if the sample is clearly heterogeneous, or if the analysed relation takes obviously the other shape than linear.

The coefficient of determination: $r_p^2$ – reflects the percentage of a dependent variable a variability which is explained by variability of an independent variable.

A created model shows a linear relationship: \begin{displaymath}
y=\beta x+\alpha.
\end{displaymath} $\beta$ and $\alpha$ coefficients of linear regression equation can be calculated using formulas: \begin{displaymath}
\displaystyle{\beta=\frac{\sum_{i=1}^n(x_i-\overline{x})(y_i-\overline{y})}{\sum_{i=1}^n(x_i-\overline{x})^2}}, \qquad \alpha=\overline{y}-\beta\overline{x}.
\end{displaymath}

EXAMPLE cont. (age-height.pqs file)

2022/02/09 12:56

The Pearson correlation coefficient significance

The test of significance for Pearson product-moment correlation coefficient is used to verify the hypothesis determining the lack of linear correlation between an analysed features of a population and it is based on the Pearson's linear correlation coefficient calculated for the sample. The closer to 0 the value of coefficient $r_p$is, the weaker dependence joins the analysed features.

Basic assumptions:

Hypotheses:

\begin{array}{cl}
\mathcal{H}_0: & R_p = 0, \\
\mathcal{H}_1: & R_p \ne 0.
\end{array}

The test statistic is defined by: \begin{displaymath}
t=\frac{r_p}{SE},
\end{displaymath}

where $\displaystyle SE=\sqrt{\frac{1-r_p^2}{n-2}}$.

The value of the test statistic can not be calculated when $r_p=1$ or $r_p=-1$ or when $n<3$.

The test statistic has the t-Student distribution with $n-2$ degrees of freedom.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

EXAMPLE cont. (age-height.pqs file)

2022/02/09 12:56

The slope coefficient significance

The test of significance for the coefficient of linear regression equation

This test is used to verify the hypothesis determining the lack of a linear dependence between an analysed features and is based on the slope coefficient (also called an effect), calculated for the sample. The closer to 0 the value of $\beta$coefficient is, the weaker dependence presents the fitted line.

Basic assumptions:

Hypotheses:

\begin{array}{cl}
\mathcal{H}_0: & \beta = 0, \\
\mathcal{H}_1: & \beta \ne 0.
\end{array}

The test statistic is defined by:

\begin{displaymath}
t=\frac{\beta}{SE}
\end{displaymath}

where:

$\displaystyle SE=\frac{s_{yx}}{sd_x\sqrt{n-1}}$,

$s_{yx}=sd_y \sqrt{\frac{n-1}{n-2}(1-r^2)}$,

$sd_x, sd_y$ – standard deviation of the value of features: $X$ and $Y$.

The value of the test statistic can not be calculated when $r_p=1$ or $r_p=-1$ or when $n<3$.

The test statistic has the t-Student distribution with $n-2$ degrees of freedom.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

Prediction is used to predict the value of a one variable (mainly a dependent variable $y_0$) on the basis of a value of an another variable (mainly an independent variable $x_0$). The accuracies of a calculated value are defined by prediction intervals calculated for it.

  • Interpolation is used to predict the value of a variable, which occurs inside the area for which the regression model was done. Interpolation is mainly a safe procedure - it is assumed only the continuity of the function of analysed variables.
  • Extrapolation is used to predict the value of variable, which occurs outside the area for which the regression model was done. As opposed to interpolation, extrapolation is often risky and is performed only not far away from the area, where the regression model was created. Similarly to the interpolation, it is assumed the continuity of the function of analysed variables.

Analysis of model residuals - explanation in the Multiple Linear Regression module.

The settings window with the Pearson's linear correlation can be opened in Statistics menu→Parametric testslinear correlation (r-Pearson) or in ''Wizard''.

EXAMPLE (age-height.pqs file)

Among some students of a ballet school, the dependence between age and height was analysed. The sample consists of 16 children and the following results of these features (related to the children) were written down:

(age, height): (5, 128) (5, 129) (5, 135) (6, 132) (6, 137) (6, 140) (7, 148) (7, 150) (8, 135) (8, 142) (8, 151) (9, 138) (9, 153) (10, 159) (10, 160) (10, 162).}

Hypotheses:

$\begin{array}{cl}
\mathcal{H}_0: & $there is no linear dependence between age and height$\\
&$for the population of children who attend to the analysed school,$\\
\mathcal{H}_1: & $there is a linear dependence between age and height$\\
&$for the population of children who attend to the analysed school.$
\end{array}$

Comparing the $p$ value < 0.0001 with the significance level $\alpha=0.05$, we draw the conclusion, that there is a linear dependence between age and height in the population of children attening to the analysed school. This dependence is directly proportional, it means that the children grow up as they are getting older.

The Pearson product-moment correlation coefficient, so the strength of the linear relation between age and height counts to $r_p$=0.83. Coefficient of determination $r_p^2=0.69$ means that about 69\% variability of height is explained by the changing of age.

From the regression equation: \begin{displaymath}
height=5.09\cdot age +105.83
\end{displaymath} it is possible to calculate the predicted value for a child, for example: in the age of 6. The predicted height of such child is 136.37cm.

2022/02/09 12:56

Comparison of correlation coefficients

The test for checking the equality of the Pearson product-moment correlation coefficients, which come from 2 independent populations

This test is used to verify the hypothesis determining the equality of 2 Pearson's linear correlation coefficients ($R_{p_1}$, $R_{p_2})$.

Basic assumptions:

  • $r_{p_1}$ and $r_{p_2}$ come from 2 samples which are chosen randomly from independent populations,
  • $r_{p_1}$ and $r_{p_2}$ describe the strength of dependence of the same features: $X$ and $Y$,
  • sizes of both samples ($n_1$ and $n_2$) are known.

Hypotheses:

\begin{array}{cl}
\mathcal{H}_0: & R_{p_1} = R_{p_2}, \\
\mathcal{H}_1: & R_{p_1} \ne R_{p_2}.
\end{array}

The test statistic is defined by:

\begin{displaymath}
t=\frac{z_{r_{p_1}}-z_{r_{p_2}}}{\sqrt{\frac{1}{n_1-3}+\frac{1}{n_2-3}}},
\end{displaymath}

where:

$\displaystyle z_{r_{p_1}}=\frac{1}{2}\ln\left(\frac{1+r_{p_1}}{1-r_{p_1}}\right)$,

$\displaystyle z_{r_{p_2}}=\frac{1}{2}\ln\left(\frac{1+r_{p_2}}{1-r_{p_2}}\right)$.

The test statistic has the t-Student distribution with $n_1+n_2-4$ degrees of freedom.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

Note

A comparison of the slope coefficients of the regression lines can be made in a similar way. </WRAP>

2022/02/09 12:56

Comparison of the slope of regression lines

The test for checking the equality of the coefficients of linear regression equation, which come from 2 independent populations

This test is used to verify the hypothesis determining the equality of 2 coefficients of the linear regression equation $\beta_1$ and $\beta_2$ in analysed populations.

Basic assumptions:

Hypotheses:

\begin{array}{cl}
\mathcal{H}_0: & \beta_1 = \beta_2, \\
\mathcal{H}_1: & \beta_1 \ne \beta_2.
\end{array}

The test statistic is defined by:

\begin{displaymath}
t=\frac{\beta_1 -\beta_2}{\sqrt{\frac{s_{yx_1}^2}{sd_{x_1}^2(n_1-1)}+\frac{s_{yx_2}^2}{sd_{x_1}^2(n_2-1)}}},
\end{displaymath}

where:

$\displaystyle s_{yx_1}=sd_{y_1}\sqrt{\frac{n_1-1}{n_1-2}(1-r_{p_1}^2)}$,

$\displaystyle s_{yx_2}=sd_{y_2}\sqrt{\frac{n_2-1}{n_2-2}(1-r_{p_2}^2)}$.

The test statistic has the t-Student distribution with $n_1+n_2-4$ degrees of freedom.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

The settings window with the comparison of correlation coefficients can be opened in Statistics menu → Parametric testsComparison of correlation coefficients.

2022/02/09 12:56
2022/02/09 12:56

Non-parametric tests

The monotonic correlation coefficients

The monotonic correlation may be described as monotonically increasing or monotonically decreasing. The relation between 2 features is presented by the monotonic increasing if the increasing of the one feature accompanies with the increasing of the other one. The relation between 2 features is presented by the monotonic decreasing if the increasing of the one feature accompanies with the decreasing of the other one.

The Spearman's rank-order correlation coefficient $r_s$ is used to describe the strength of monotonic relations between 2 features: $X$ and $Y$. It may be calculated on an ordinal scale or an interval one. The value of the Spearman's rank correlation coefficient should be calculated using the following formula:

\begin{displaymath} \label{rs}
r_s=1-\frac{6\sum_{i=1}^nd_i^2}{n(n^2-1)},
\end{displaymath}

where:

$d_i=R_{x_i}-R_{y_i}$ – difference of ranks for the feature $X$ and $Y$,

$n$ number of $d_i$.

This formula is modified when there are ties:

\begin{displaymath}
r_s=\frac{\Sigma_X+\Sigma_Y-\sum_{i=1}^nd_i^2}{2\sqrt{\Sigma_X\Sigma_Y}},
\end{displaymath}

where:

  • $\Sigma_X=\frac{n^3-n-T_X}{12}$, $\Sigma_Y=\frac{n^3-n-T_Y}{12}$,
  • $T_X=\sum_{i=1}^s (t_{i_{(X)}}^3-t_{i_{(X)}})$, $T_Y=\sum_{i=1}^s (t_{i_{(Y)}}^3-t_{i_{(Y)}})$,
  • $t$ – number of cases included in tie.

This correction is used, when ties occur. If there are no ties, the correction is not calculated, because the correction is reduced to the formula describing the above equation.

Note

$R_s$ – the Spearman's rank correlation coefficient in a population;

$r_s$ – the Spearman's rank correlation coefficient in a sample.

The value of $r_s\in<-1; 1>$, and it should be interpreted the following way:

  • $r_s\approx1$ means a strong positive monotonic correlation (increasing) – when the independent variable increases, the dependent variable increases too;
  • $r_s\approx-1$ means a strong negative monotonic correlation (decreasing) – when the independent variable increases, the dependent variable decreases;
  • if the Spearman's correlation coefficient is of the value equal or very close to zero, there is no monotonic dependence between the analysed features (but there might exist another relation - a non monotonic one, for example a sinusoidal relation).

The Kendall's tau correlation coefficient (Kendall (1938)1)) is used to describe the strength of monotonic relations between features . It may be calculated on an ordinal scale or interval one. The value of the Kendall's $\tilde{\tau}$ correlation coefficient should be calculated using the following formula: \begin{displaymath}
\tilde{\tau}=\frac{2(n_C-n_D)}{\sqrt{n(n-1)-T_X}\sqrt{n(n-1)-T_Y}},
\end{displaymath}

where:

  • $n_C$ – number of pairs of observations, for which the values of the ranks for the $X$ feature as well as $Y$ feature are changed in the same direction (the number of agreed pairs),
  • $n_D$ – number of pairs of observations, for which the values of the ranks for the $X$ feature are changed in the different direction than for the $Y$ feature (the number of disagreed pairs),
  • $T_X=\sum_{i=1}^s (t_{i_{(X)}}^2-t_{i_{(X)}})$, $T_Y=\sum_{i=1}^s (t_{i_{(Y)}}^2-t_{i_{(Y)}})$,
  • $t$ – number of cases included in a tie.

The formula for the $\tilde{\tau}$ correlation coefficient includes the correction for ties. This correction is used, when ties occur (if there are no ties, the correction is not calculated, because of $T_X=0$ i $T_Y=0$) .

Note

$\tau$ – the Kendall's correlation coefficient in a population;

$\tilde{\tau}$ – the Kendall's correlation coefficient in a sample.

The value of $\tilde{\tau}\in<-1; 1>$, and it should be interpreted the following way:

  • $\tilde{\tau}\approx1$ means a strong agreement of the sequence of ranks (the increasing monotonic correlation) – when the independent variable increases, the dependent variable increases too;
  • $\tilde{\tau}\approx-1$ means a strong disagreement of the sequence of ranks (the decreasing monotonic correlation) – when the independent variable increases, the dependent variable decreases;
  • if the Kendall's $\tilde{\tau}$ correlation coefficient is of the value equal or very close to zero, there is no monotonic dependence between analysed features (but there might exist another relation - a non monotonic one, for example a sinusoidal relation).

Spearman's versus Kendall's coefficient

  • for an interval scale with a normality of the distribution, the $r_s$ gives the results which are close to $r_p$, but $\tilde{\tau}$ may be totally different from $r_p$,
  • the $\tilde{\tau}$ value is less or equal to $r_p$ value,
  • the $\tilde{\tau}$ is an unbiased estimator of the population parameter $\tau$, while the $r_s$ is a biased estimator of the population parameter $R_s$.

EXAMPLE cont. (sex-height.pqs file)

2022/02/09 12:56

The Spearman's rank-order correlation coefficient

The test of significance for the Spearman's rank-order correlation coefficient is used to verify the hypothesis determining the lack of monotonic correlation between analysed features of the population and it is based on the Spearman's rank-order correlation coefficient calculated for the sample. The closer to 0 the value of $r_s$ coefficient is, the weaker dependence joins the analysed features.

Basic assumptions:

Hypotheses:

\begin{array}{cl}
\mathcal{H}_0: & R_s = 0, \\
\mathcal{H}_1: & R_s \ne 0.
\end{array}

The test statistic is defined by:

\begin{displaymath}
t=\frac{r_s}{SE},
\end{displaymath}

where $\displaystyle SE=\sqrt{\frac{1-r_s^2}{n-2}}$.

The value of the test statistic can not be calculated when $r_s=1$ lub $r_s=-1$ or when $n<3$.

The test statistic has the t-Student distribution with $n-2$ degrees of freedom.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

The settings window with the Spearman's monotonic correlation can be opened in Statistics menu → NonParametric testsmonotonic correlation (r-Spearman) or in ''Wizard''.

EXAMPLE (LDL weeks.pqs file)

The effectiveness of a new therapy designed to lower cholesterol levels in the LDL fraction was studied. 88 people at different stages of the treatment were examined. We will test whether LDL cholesterol levels decrease and stabilize with the duration of the treatment (time in weeks).

Hypotheses:

$\begin{array}{cl}
\mathcal{H}_0: & $In the population, there is no monotonic relationship between treatment time and LDL levels,$\\
\mathcal{H}_1: & $In the population, there is a monotonic relationship between treatment time and LDL levels.$
\end{array}$

Comparing $p$<0.0001 with a significance level $\alpha=0.05$ we find that there is a statistically significant monotonic relationship between treatment time and LDL levels. This relationship is initially decreasing and begins to stabilize after 150 weeks. The Spearman's monotonic correlation coefficient and therefore the strength of the monotonic relationship for this relationship is quite high at $r_s$=-0.78. The graph was plotted by curve fitting through local LOWESS linear smoothing techniques.

2022/02/09 12:56

The Kendall's tau correlation coefficient

The test of significance for the Kendall's $\tilde{\tau}$ correlation coefficient is used to verify the hypothesis determining the lack of monotonic correlation between analysed features of population. It is based on the Kendall's tau correlation coefficient calculated for the sample. The closer to 0 the value of tau is, the weaker dependence joins the analysed features.

Basic assumptions:

Hypotheses:

\begin{array}{cl}
\mathcal{H}_0: & \tau = 0, \\
\mathcal{H}_1: & \tau \ne 0.
\end{array}

The test statistic is defined by:

\begin{displaymath}
Z=\frac{3\tilde{\tau}\sqrt{n(n-1)}}{\sqrt{2(2n+5)}}.
\end{displaymath}

The test statistic asymptotically (for a large sample size) has the normal distribution.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

The settings window with the Kendall's monotonic correlation can be opened in Statistics menu → NonParametric testsmonotonic correlation (tau-Kendall) or in ''Wizard''.

EXAMPLE cont. (LDL weeks.pqs file)

Hypotheses: $\begin{array}{cl}
\mathcal{H}_0: & $In the population, there is no monotonic relationship between treatment time and LDL levels,$\\
\mathcal{H}_1: & $In the population, there is a monotonic relationship between treatment time and LDL levels.$
\end{array}$

Comparing p<0.0001 with a significance level $\alpha=0.05$ we find that there is a statistically significant monotonic relationship between treatment time and LDL levels. This relationship is initially decreasing and begins to stabilize after 150 weeks. The Kendall's monotonic correlation coefficient, and therefore the strength of the monotonic relationship for this relationship is quite high at $\tilde{\tau}$=-0.60. The graph was plotted by curve fitting through local LOWESS linear smoothing techniques.

2022/02/09 12:56

Contingency tables coefficients and their statistical significance

The contingency coefficients are calculated for the raw data or the data gathered in a contingency table.

The settings window with the measures of correlation can be opened in Statistics menu → NonParametric testsCh-square, Fisher, OR/RR option Measures of dependence… or in ''Wizard''.

The Yule's Q contingency coefficient

The Yule's $Q$ contingency coefficient (Yule, 19002)) is a measure of correlation, which can be calculated for $2\times2$ contingency tables.

\begin{displaymath}
Q=\frac{O_{11}O_{22}-O_{12}O_{21}}{O_{11}O_{22}+O_{12}O_{21}},
\end{displaymath}

where:

$O_{11}, O_{12}, O_{21}, O_{22}$ - observed frequencies in a contingency table.

The $Q$ coefficient value is included in a range of $<-1; 1>$. The closer to 0 the value of the $Q$ is, the weaker dependence joins the analysed features, and the closer to $-$1 or +1, the stronger dependence joins the analysed features. There is one disadvantage of this coefficient. It is not much resistant to small observed frequencies (if one of them is 0, the coefficient might wrongly indicate the total dependence of features).

The statistic significance of the Yule's $Q$ coefficient is defined by the $Z$ test.

Hypotheses:

$\begin{array}{cl}
\mathcal{H}_0: &Q=0,\\
\mathcal{H}_1: &Q\neq 0.
\end{array}$

The test statistic is defined by:

\begin{displaymath}
Z=\frac{Q}{\sqrt{\frac{1}{4}(1-Q^2)^2(\frac{1}{O_{11}}+\frac{1}{O_{12}}+\frac{1}{O_{21}}+\frac{1}{O_{22}})}}.
\end{displaymath}

The test statistic asymptotically (for a large sample size) has the normal distribution.

The p-value, designated on the basis of the test statistic, is compared with the significance level $\alpha$:

\begin{array}{ccl}
$ if $ p \le \alpha & \Longrightarrow & $ reject $ \mathcal{H}_0 $ and accept $ 	\mathcal{H}_1, \\
$ if $ p > \alpha & \Longrightarrow & $ there is no reason to reject $ \mathcal{H}_0. \\
\end{array}

The $\phi$ contingency coefficient

The Phi contingency coefficient is a measure of correlation, which can be calculated for $2\times2$ contingency tables.

\begin{displaymath}
\phi=\sqrt{\frac{\chi^2}{n}},
\end{displaymath}

where:

Chi-square – value of the $\chi^2$ test statistic,

$n$ – total frequency in a contingency table.

The $\phi$ coefficient value is included in a range of $<0; 1>$. The closer to 0 the value of $\phi$ is, the weaker dependence joins the analysed features, and the closer to 1, the stronger dependence joins the analysed features.

The $\phi$ contingency coefficient is considered as statistically significant, if the p-value calculated on the basis of the $\chi^2$ test (designated for this table) is equal to or less than the significance level $\alpha$.

The Cramer's V contingency coefficient

The Cramer's V contingency coefficient (Cramer, 19463)), is an extension of the $\phi$ coefficient on $r\times c$ contingency tables.

\begin{displaymath}
V=\sqrt{\frac{\chi^2}{n(w'-1)}},
\end{displaymath}

where:

Chi-square – value of the $\chi^2$ test statistic,

$n$ – total frequency in a contingency table,

$w'$ – the smaller the value out of $r$ and $c$.

The $V$ coefficient value is included in a range of $<0; 1>$. The closer to 0 the value of $V$ is, the weaker dependence joins the analysed features, and the closer to 1, the stronger dependence joins the analysed features. The $V$ coefficient value depends also on the table size, so you should not use this coefficient to compare different sizes of contingency tables.

The $V$ contingency coefficient is considered as statistically significant, if the p-value calculated on the basis of the $\chi^2$ test (designated for this table) is equal to or less than the significance level $\alpha$.

W-Cohen contingency coefficient

The $W$-Cohen contingency coefficient (Cohen (1988)4)), is a modification of the V-Cramer coefficient and is computable for $r\times c$ tables.

\begin{displaymath}
W=\sqrt{\frac{\chi^2}{n(w'-1)}}\sqrt{w'-1},
\end{displaymath}

where:

Chi-square – value of the $\chi^2$ test statistic,

$n$ – total frequency in a contingency table,

$w'$ – the smaller the value out of $r$ and $c$.

The $W$ coefficient value is included in a range of $<0; \max W>$, where $\max W=\sqrt{w'-1}$ (for tables where at least one variable contains only two categories, the value of the coefficient $W$ is in the range $<0; 1>$). The closer to 0 the value of $W$ is, the weaker dependence joins the analysed features, and the closer to $\max W$, the stronger dependence joins the analysed features. The $W$ coefficient value depends also on the table size, so you should not use this coefficient to compare different sizes of contingency tables.

The $W$ contingency coefficient is considered as statistically significant, if the p-value calculated on the basis of the $\chi^2$ test (designated for this table) is equal to or less than the significance level $\alpha$.

The Pearson's C contingency coefficient

The Pearson's $C$ contingency coefficient is a measure of correlation, which can be calculated for $r\times c$ contingency tables.

\begin{displaymath}
C=\sqrt{\frac{\chi^2}{\chi^2+n}},
\end{displaymath}

where:

Chi-square – value of the $\chi^2$ test statistic,

$n$ – total frequency in a contingency table.

The $C$ coefficient value is included in a range of $<0; 1)$. The closer to 0 the value of $C$ is, the weaker dependence joins the analysed features, and the farther from 0, the stronger dependence joins the analysed features. The $C$ coefficient value depends also on the table size (the bigger table, the closer to 1 $C$ value can be), that is why it should be calculated the top limit, which the $C$ coefficient may gain – for the particular table size:

\begin{displaymath}
C_{max}=\sqrt{\frac{w'-1}{w}},
\end{displaymath}

where:

$w'$ – the smaller value out of $r$ and $c$.

An uncomfortable consequence of dependence of $C$ value on a table size is the lack of possibility of comparison the $C$ coefficient value calculated for the various sizes of contingency tables. A little bit better measure is a contingency coefficient adjusted for the table size ($C_{adj}$):

\begin{displaymath}
C_{adj}=\frac{C}{C_{max}}.
\end{displaymath}

The $C$ contingency coefficient is considered as statistically significant, if the p-value calculated on the basis of the $\chi^2$ test (designated for this table) is equal to or less than significance level $\alpha$.

EXAMPLE (sex-exam.pqs file)

There is a sample of 170 persons ($n=170$), who have 2 features analysed ($X$=sex, $Y$=passing the exam). Each of these features occurs in 2 categories ($X_1$=f, $X_2$=m, $Y_1$=yes, $Y_2$=no). Basing on the sample, we would like to get to know, if there is any dependence between sex and passing the exam in an analysed population. The data distribution is presented in a contingency table:}

\begin{tabular}{|c|c||c|c|c|}
\hline
\multicolumn{2}{|c||}{Observed frequencies}& \multicolumn{3}{|c|}{passing the exam}\\\cline{3-5}
\multicolumn{2}{|c||}{$O_{ij}$} & yes & no & total \\\hline \hline
\multirow{3}{*}{sex}& f & 50 & 40 & 90 \\\cline{2-5}
& m & 20 & 60 & 80 \\\cline{2-5}
& total & 70 & 100 & 170\\\hline
\end{tabular}

The test statistic value is $\chi^2=16.33$ and the $p$ value calculated for it: p<0.0001. The result indicates that there is a statistically significant dependence between sex and passing the exam in the analysed population.

Coefficient values, which are based on the $\chi^2$ test, so the strength of the correlation between analysed features are:

$C_{adj}$-Pearson = 0.42.

$V$-Cramer = $\phi$ = $W$-Cohen = 0.31

The $Q$-Yule = 0.58, and the $p$ value of the $Z$ test (similarly to $\chi^2$ test) indicates the statistically significant dependence between the analysed features.

2022/02/09 12:56
2022/02/09 12:56
 
1)
Kendall M.G. (1938), A new measure of rank correlation. Biometrika, 30, 81-93
2)
Yule G. (1900), On the association of the attributes in statistics: With illustrations from the material ofthe childhood society, and c. Philosophical Transactions of the Royal Society, Series A, 194,257-3 19
3)
Cramkr H. (1946), Mathematical models of statistics. Princeton, NJ: Princeton University Press
4)
Cohen J. (1988), Statistical Power Analysis for the Behavioral Sciences, Lawrence Erlbaum Associates, Hillsdale, New Jersey
en/statpqpl/korelpl.txt · ostatnio zmienione: 2022/02/13 18:28 przez admin

Narzędzia strony