我目前正在进行仿真,所以我想看看如果效果大小不同,会发生什么。如何使用当前代码为费舍尔的精确测试测试不同的效果大小?
# 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")