■
> sqr.obs<-function(x){ n<-sum(x) pob<-x/n print(pob) } #関数の定義 > data [,1] [,2] [1,] 5 7 [2,] 13 12 > sqr.obs(data)->data.obs [,1] [,2] [1,] 0.1351351 0.1891892 [2,] 0.3513514 0.3243243 > ES.w2(data.obs)->data.w > data.w [1] 0.09678053 #Cohenのeffect sizeを算出。 > pwr.chisq.test(w=data.w,df=1,N=37000) #Nを1000倍 Chi squared power calculation w = 0.09678053 N = 37000 df = 1 sig.level = 0.05 power = 1 NOTE: N is the number of observations > pwr.chisq.test(w=data.w,df=1,N=370) #Nを10倍 Chi squared power calculation w = 0.09678053 N = 370 df = 1 sig.level = 0.05 power = 0.4608922 NOTE: N is the number of observations
検出力が上がってます。