> markres <- read.table("C:\\data\\CH02TA04.txt",header=F,col.names=c("Y1","Y2")) > > attach(markres) The following object(s) are masked from 'markres (position 3)': Y1, Y2 > > R1 <- rank(Y1) > R2 <- rank(Y2) > > print(cbind(Y1,Y2,R1,R2)) Y1 Y2 R1 R2 [1,] 29 127 1 2 [2,] 435 214 8 11 [3,] 86 133 3 4 [4,] 1090 208 11 10 [5,] 219 153 7 6 [6,] 503 184 9 8 [7,] 47 130 2 3 [8,] 3524 217 12 12 [9,] 185 141 6 5 [10,] 98 154 5 7 [11,] 952 194 10 9 [12,] 89 103 4 1 > > n <- length(Y1) > > r_S <- cor(R1,R2) > r_S [1] 0.8951049 > > t_rS <- r_S*sqrt(n-2)/sqrt(1-r_S^2) > t_r_S Error: object 't_r_S' not found > > t_995 <- qt(.995,n-2) > t_995 [1] 3.169273 > > p_rS <- 2*(1-pt(abs(t_r_S),n-2)) Error in pt(abs(t_r_S), n - 2) : object 't_r_S' not found > p_rS Error: object 'p_rS' not found > > cor.test(Y1,Y2,method="spearman") Spearman's rank correlation rho data: Y1 and Y2 S = 30, p-value = 5.942e-06 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.8951049 > >