To implement the Non-Parametric Hypothesis Testing using R.
#Non – Parametric Hypothesis testing
#Input
x<-c(1090,500,9,16,29,37,41,59,735,923)
y<-c(800,276,65,9,466,37,955,749,3787,577)
z<-c(0,1,1,0,0,0,1,1,0,0)
#Checking Normality
#Anderson Darling test
library(“nortest”)
ad.test(x)
ad.test(y)
#Shapiro test
shapiro.test(x)
shapiro.test(y)
#One Sample sign test
binom.test(x=10,n=18)
#Wilcoxon signed rank test
#Equivalent test for two dependent samples t, z test
wilcox.test(x,y,paired = T)
#Wilcoxon rank sum test or Mann- Whitney test
#Equivalent test for two independent samples t, z test
wilcox.test(y,x)
#If x is numeric and z is binary factor
wilcox.test(x~z)
#Chi- Squared test
#Contingency table
tab<-table(x,y)
print(tab)
chisq.test(tab)
#Levene’s test
#Equivalent test for f test
library(“car”)
z<-as.factor(z)
leveneTest(x~z)
#Kruskal- Wallis test
#Equivalent test for one way ANOVA
kruskal.test(mtcars$am~mtcars$mpg)