This page provides 2 calculations for large contingency tables of counts, the chi squares test and the non-parametric Spearman's correlation coefficient ρ
Power(parametric) | Power(non-parametric) |
0.80 | 0.818 |
0.90 | 0.909 |
0.95 | 0.955 |
0.99 | 0.991 |
There is no specific calculations to estimate sample size requirements for Spearman's vorrelation coefficient. According to Siegel S and Castellan Jr. N J (2000) however, the efficientcy of non-parametric correlation coefficient such as Spearman or Kendall is 91% that of Pearson's (see reference). The appropriare modification in the power value in the calculations need to be made, where
β(non-parametric) = β(paramtric) x 0.91
The table to the tight shows the required modifications of commonly used powers. Calculations to estimate sample size for correlation coefficients are in
SSizCorr.php
References
Siegel S and Castellan Jr. N J (2000) Nonparametric Statistics for the Behavioral Sciences (Second Edition). McGraw-Hill International Edition Sydney ISBN 0-07-100326-6
Chi Squares : p.191-200
Spearman's correlation : p.235-244, Table Q in p.360-361.
R codes for Chi Square (large contingency table) and Spearman's Correlation Coefficient
Two programs, for entry by raw data or by table of counts
Program 1: raw data data table of 2 columns x and y
# data entry
dat = ("
X Y
1 1
2 2
3 3
2 3
5 6
2 3
4 3
5 5
")
df <- read.table(textConnection(dat),header=TRUE) # conversion to data frame
result <- chisq.test(df$X,df$Y)
result # result of chi square test
result <- cor.test(df$X,df$Y, method="spearman") # Correlation
result # result of Spearman Correlation
The results are as follows
> result # result of chi square test
Pearson's Chi-squared test
data: df$X and df$Y
X-squared = 17.333, df = 16, p-value = 0.3644
> result # result of Spearman Correlation
Spearman's rank correlation rho
data: df$X and df$Y
S = 9.2934, p-value = 0.003111
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.8893639
Program 2: data is a table of counts
# data entry
dat = ("
6 0 5
6 0 10
3 5 8
0 15 7
")
mx <- read.table(textConnection(dat),header=FALSE) # conversion to data matrix
# create X and Y from matrix of counts mx
# vectors of X and Y
X <- vector()
Y <- vector()
for(i in 1:nrow(mx))
{
for(j in 1:ncol(mx))
{
if(mx[i,j]>0)
{
for(k in 1:mx[i,j])
{
X <- append(X,i)
Y <- append(Y,j)
}
}
}
}
# Calculations
result <- chisq.test(X, Y)
result # result of chi square test
result <- cor.test(X, Y, method="spearman") # Correlation
result # result of Spearman Correlation
The results are as follows
> result # result of chi square test
Pearson's Chi-squared test
data: X and Y
X-squared = 31.644, df = 6, p-value = 1.909e-05
> result # result of Spearman Correlation
Spearman's rank correlation rho
data: X and Y
S = 42101, p-value = 0.5266
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.07996065