[R] How to try different effect sizes for Fisher's exact test?
Kelly Wu
kekwu @ending from ucd@vi@@edu
Mon Jul 16 20:46:06 CEST 2018
I am currently working on a simulation, and I would like to see what happens with various effect sizes. How would I test out different effect sizes for the Fisher's exact test with my current code?
set.seed(23)
# p1<-response in controls
# p2<-response in treated
# Generating random deviates from a Uniform(0,1) distribution
control.year1<-(runif(16, min = 0, max = 1))
treat.year1<-(runif(16, min = 0, max = 1))
#Generating dichotomous response variables for each group
control.respond1<-ifelse(control.year1<=0.05,1,0)
treat.respond1<-ifelse(treat.year1<=0.30,1,0)
#Summing number of responses from each group
control.no1<-sum(control.respond1==0)
control.yes1<-sum(control.respond1==1)
treat.no1<-sum(treat.respond1==0)
treat.yes1<-sum(treat.respond1==1)
#Perform the Fisher's exact test (one sided) with p<=0.01
fisher<-matrix(c(control.no1,control.yes1,treat.no1,treat.yes1),nrow=2,ncol=2)
f<-fisher.test(fisher,alternative = "greater”)
Thanks,
Kelly
[[alternative HTML version deleted]]
More information about the R-help
mailing list