高校数学の質問スレ(医者・東大卒専用) Part438 (991レス)
1-

804: 04/30(水)04:58 ID:wedVH8wl(2/10) AAS
options(warn = -1)
alpha=0.05
sim=\(N=100){
A=sample(1:(N-2),1) # Ensure A leaves enough room for B and C
remaining = N - A
if(remaining > 1){
B=sample(1:(remaining-1),1) # Ensure B is at least 1
C=N-A-B
ABC=c(A,B,C)
abc=sapply(ABC,\(x) if(x > 0) sample(1:x,1) else 0) # Handle case where a group size might be 0 (though unlikely with the new A and B sampling)
x=abc
n=ABC
contig=rbind(s=x,f=n-x)
pg=chisq.test(contig,correct=FALSE)$p.value
minpp=min(as.vector(
pairwise.prop.test(x,n,correct=FALSE,p.adj="bon")$p.value),na.rm=TRUE)
list(pg=pg,minpp=minpp,x=x,n=n)
} else {
# If A is too large, return NULL or some indicator of an invalid simulation
return(NULL)
}
}

res = sim()
while(is.null(res) || res$pg < alpha | res$minpp > alpha) {
res = sim()
}
res
1-
あと 187 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.007s