jinghuazhao / R

R packages
https://jinghuazhao.github.io/R/
12 stars 4 forks source link

Ccsize produces neg and pos numbers instead of power #6

Open da3hill opened 1 year ago

da3hill commented 1 year ago

Hi Jinghuazhao; Ran the example code from the gap documentation for ccsize in R, because previously solid code was not working. ccsize produces negative and positive numbers in rightmost column, not power. R version is 4.3.1 (also used 4.2.0) and gap version is 1.5-3.

  See code and result below. Thanks for any help.

D. Hill

outfile <- "table1.txt"

cat("n","pD","p1","theta","q","power\n",file=outfile,sep="\t") alpha <- 0.05 n <- 1000 for(pD in c(0.10,0.05))

  • {
  • for(p1 in c(0.3,0.5))
  • {
  • for(theta in c(0.5,1.0))
  • {
  • for(q in c(0.1,0.2))
  • {
  • power <- ccsize(n,q,pD,p1,alpha,theta)
  • cat(n,"\t",pD,"\t",p1,"\t",theta,"\t",q,"\t",signif(power,3),"\n",
  • file=outfile,append=TRUE)

table1<-read.table(outfile,header=TRUE,sep="\t")

unlink(outfile) print(table1) n pD p1 theta q power 1 1000 0.10 0.3 0.5 0.10 -121 2 1000 0.10 0.3 0.5 0.20 -121 3 1000 0.10 0.3 1.0 0.10 -111 4 1000 0.10 0.3 1.0 0.20 -111 5 1000 0.10 0.5 0.5 0.10 -123 6 1000 0.10 0.5 0.5 0.20 -123 7 1000 0.10 0.5 1.0 0.10 -111 8 1000 0.10 0.5 1.0 0.20 -111 9 1000 0.05 0.3 0.5 0.10 -54 10 1000 0.05 0.3 0.5 0.20 -54 11 1000 0.05 0.3 1.0 0.10 -52 12 1000 0.05 0.3 1.0 0.20 -52 13 1000 0.05 0.5 0.5 0.10 -55 14 1000 0.05 0.5 0.5 0.20 -55 15 1000 0.05 0.5 1.0 0.10 -52 16 1000 0.05 0.5 1.0 0.20 -52 17 5000 0.05 0.3 0.5 0.01 -326 18 5000 0.05 0.3 0.5 0.02 -326 19 5000 0.05 0.3 1.0 0.01 -263 20 5000 0.05 0.3 1.0 0.02 -263 21 5000 0.05 0.5 0.5 0.01 -342 22 5000 0.05 0.5 0.5 0.02 -342 23 5000 0.05 0.5 1.0 0.01 -263 24 5000 0.05 0.5 1.0 0.02 -263 25 5000 0.01 0.3 0.5 0.01 -52 26 5000 0.01 0.3 0.5 0.02 -52 27 5000 0.01 0.3 1.0 0.01 -50 28 5000 0.01 0.3 1.0 0.02 -50 29 5000 0.01 0.5 0.5 0.01 -52 30 5000 0.01 0.5 0.5 0.02 -52 31 5000 0.01 0.5 1.0 0.01 -50 32 5000 0.01 0.5 1.0 0.02 -50

jinghuazhao commented 1 year ago

Thanks for bringing this to my attention. It appears the default value has been changed -- it will give power if ccsize(...,power=TRUE) is used. For a temporary fix, I have reset ccsize(power=TRUE) in the GitHub version.