--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to julia-stats...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 2000-2016 The R Core Team
* Copyright (C) 2003 The R Foundation
* based on AS 89 (C) 1975 Royal Statistical Society
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, a copy is available at
* https://www.R-project.org/Licenses/
*
*/
n = length(x)
ρ = corspearman(x, y)
S = (ρ-1)*(n^3 - n)/(-6)
rank_x,f_x = HypothesisTests.tiedrank_adj(x)
rank_y,f_y = HypothesisTests.tiedrank_adj(y)
meanS = ((n^3 - n)/6) - (f_x/12) - (f_y/12)
sdS = sqrt((((n-1)*(n^2)*((n+1)^2))/36) * (1-(f_x/(n^3 - n))) * (1-(f_y/(n^3 - n))))
cdf(Normal(), (S-meanS)/sdS)