Created
April 6, 2016 20:54
-
-
Save tomquisel/545cc4e4d9e9abbb48aa0a84459079f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def do_R_wilcoxon(before, after, paired=True, two_tailed=False): | |
b_mat = before.as_matrix() | |
a_mat = after.as_matrix() | |
alternative = 'g' | |
if two_tailed: | |
alternative = 'two.sided' | |
%R -i b_mat,a_mat,paired,alternative -o wilcox_res wilcox_res=wilcox.test(b_mat, a_mat, paired=paired, exact=TRUE, conf.int=TRUE, alternative=alternative) | |
#print list(enumerate(wilcox_res)) | |
# this returns just the p-value and the conf interval | |
return { | |
'p-value': wilcox_res[2][0], | |
'95_conf_int': list(wilcox_res[7]), | |
'statistic': wilcox_res[0][0], | |
'before': before, | |
'after': after, | |
'pseudo_median': wilcox_res[8][0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment