Created
March 7, 2016 18:34
-
-
Save cyrilobolonsky/d60d6916edb5e3cd85b7 to your computer and use it in GitHub Desktop.
A #glfintech R turorial on statistics discussing hypothesis tests - parametric tests (z-test, t-test and ANOVA) and non-parametric tests (Mann-Whitney Test, Wilcoxon Rank-sum test, Wilcoxon Signed-rank Test, Kruskal Wallis Test).
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
#non-parametric tests in R | |
dengue.fewer <-c(3000,3200,3500,5068,5679,6200,6300,7020) | |
scrub.typhus<-c(4400,4500,5900,6839,7561,9047,12300,14000) | |
wilcox.test(dengue.fewer,scrub.typhus) | |
t.test(dengue.fewer,scrub.typhus,var.equal=T) | |
ttest.wilcox.examples <- function(x,y,z,k) | |
{ | |
subjects <- x | |
mean1 <- y | |
mean2 <- z | |
standarddev <- k | |
print( c("Number of measurements: ", x)) | |
print( c("Mean of group 1: ", y)) | |
print( c( "Mean of group 2: ",z)) | |
print( c("Standard deviation: ", k)) | |
group1 <- rnorm(x, y, k) | |
group2 <- rnorm(x, z, k) | |
framedata <- cbind(group1, group2) | |
print(framedata) | |
print( list (t.test(group1, group2, var.equal = T), wilcox.test(group1, group2))) | |
} | |
set.seed(570) | |
ttest.wilcox.examples(13,90,100,10) | |
#try | |
A <- c(91,91,93,106,97,108,97,105,106,103,105,96,105,95,90,101) | |
B <- c(90,89,85,99,93,104,89,103,102,95,103,95,105,87,86,101) | |
t.test(A,B,paired=T) | |
wilcox.test(A,B, paired=T) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment